OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Texture2DMultisample.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12  *
13  * Texture2DMultisample codes Copyright (C) 2010 Marcin Hajder
14  * Thanks to to my company http://www.ai.com.pl for allowing me free this work.
15 */
16 
17 #ifndef OSG_TEXTURE2DMS
18 #define OSG_TEXTURE2DMS 1
19 
20 #include <osg/Texture>
21 
22 namespace osg {
23 
30 {
31  public :
32 
34 
35  Texture2DMultisample(GLsizei numSamples, GLboolean fixedsamplelocations);
36 
39 
41 
43  virtual int compare(const StateAttribute& rhs) const;
44 
45  virtual GLenum getTextureTarget() const
46  {
48  }
49 
51  virtual bool getModeUsage(StateAttribute::ModeUsage&) const { return false; }
52 
55  inline void setTextureSize(int width, int height) const
56  {
57  _textureWidth = width;
58  _textureHeight = height;
59  }
60 
61  inline void setNumSamples( int samples ) { _numSamples = samples; }
62  GLsizei getNumSamples() const { return _numSamples; }
63 
64  // unnecessary for Texture2DMultisample
65  virtual void setImage(unsigned int /*face*/, Image* /*image*/) {}
66  virtual Image* getImage(unsigned int /*face*/) { return NULL; }
67  virtual const Image* getImage(unsigned int /*face*/) const { return NULL; }
68  virtual unsigned int getNumImages() const {return 0; }
69  virtual void allocateMipmap(State& /*state*/) const {}
70 
71  void setTextureWidth(int width) { _textureWidth=width; }
72  void setTextureHeight(int height) { _textureHeight=height; }
73 
74  virtual int getTextureWidth() const { return _textureWidth; }
75  virtual int getTextureHeight() const { return _textureHeight; }
76  virtual int getTextureDepth() const { return 1; }
77 
80  virtual void apply(State& state) const;
81 
82  protected :
83 
84  virtual ~Texture2DMultisample();
85 
86  virtual void computeInternalFormat() const;
87 
89  mutable GLsizei _textureWidth, _textureHeight;
90 
91  mutable GLsizei _numSamples;
92 
93  mutable GLboolean _fixedsamplelocations;
94 
95 };
96 
97 }
98 
99 #endif
#define OSG_EXPORT
Definition: Export.h:43
virtual Image * getImage(unsigned int)
#define NULL
Definition: Export.h:59
virtual void setImage(unsigned int, Image *)
virtual unsigned int getNumImages() const
#define GL_TEXTURE_2D_MULTISAMPLE
Definition: Texture.h:236
void setTextureSize(int width, int height) const
GLint GLenum GLsizei width
Definition: GLU.h:71
#define META_StateAttribute(library, name, type)
GLint GLenum GLsizei GLsizei height
Definition: GLU.h:71
virtual void allocateMipmap(State &) const
virtual const Image * getImage(unsigned int) const
Definition: AlphaFunc.h:19
virtual int getTextureWidth() const
virtual GLenum getTextureTarget() const
virtual int getTextureHeight() const
virtual int getTextureDepth() const
virtual bool getModeUsage(StateAttribute::ModeUsage &) const