opensurgsim
OsgTexture2d.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_OSGTEXTURE2D_H
17 #define SURGSIM_GRAPHICS_OSGTEXTURE2D_H
18 
19 #include "SurgSim/Graphics/OsgTexture.h"
20 #include "SurgSim/Graphics/Texture2d.h"
21 
22 #include <osg/Texture2D>
23 
24 #include "SurgSim/Framework/Accessible.h"
25 #include <boost/any.hpp>
26 #include <memory>
27 
28 #if defined(_MSC_VER)
29 #pragma warning(push)
30 #pragma warning(disable:4250)
31 #endif
32 
33 namespace SurgSim
34 {
35 
36 namespace Graphics
37 {
38 
42 class OsgTexture2d : public OsgTexture, public Texture2d
43 {
44 public:
47  OsgTexture2d();
48 
53  virtual void setSize(int width, int height);
54 
58  virtual void getSize(int* width, int* height) const;
59 
61  osg::ref_ptr<osg::Texture2D> getOsgTexture2d() const
62  {
63  return static_cast<osg::Texture2D*>(getOsgTexture().get());
64  }
65 };
66 
67 }; // namespace Graphics
68 
69 
70 namespace Framework
71 {
74 template <>
75 std::shared_ptr<SurgSim::Graphics::OsgTexture2d> convert(boost::any val);
76 }
77 
78 }; // namespace SurgSim
79 
80 #if defined(_MSC_VER)
81 #pragma warning(pop)
82 #endif
83 
84 #endif // SURGSIM_GRAPHICS_OSGTEXTURE2D_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
osg::ref_ptr< osg::Texture > getOsgTexture() const
Returns the osg::Texture1D.
Definition: OsgTexture.h:44
virtual void getSize(int *width, int *height) const
Gets the size of the texture.
Definition: OsgTexture2d.cpp:29
osg::ref_ptr< osg::Texture2D > getOsgTexture2d() const
Returns the osg::Texture2D.
Definition: OsgTexture2d.h:61
Base class defining the interface for a 2D Graphics Texture.
Definition: Texture2d.h:30
Base class for OSG implementations of Graphics Textures.
Definition: OsgTexture.h:32
OsgTexture2d()
Constructor.
Definition: OsgTexture2d.cpp:20
virtual void setSize(int width, int height)
Sets the size of the texture.
Definition: OsgTexture2d.cpp:24
OSG implementation of a 2D Texture.
Definition: OsgTexture2d.h:42