OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PointSprite.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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 
14 #ifndef OSG_POINTSPRITE
15 #define OSG_POINTSPRITE 1
16 
17 #include <osg/GL>
18 #include <osg/StateAttribute>
19 
20 #ifndef GL_ARB_point_sprite
21 #define GL_POINT_SPRITE_ARB 0x8861
22 #define GL_COORD_REPLACE_ARB 0x8862
23 #endif
24 
25 #ifndef GL_POINT_SPRITE_COORD_ORIGIN
26 #define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
27 #define GL_LOWER_LEFT 0x8CA1
28 #define GL_UPPER_LEFT 0x8CA2
29 #endif
30 
31 namespace osg {
32 
35 public:
36 
37  PointSprite();
38 
41  StateAttribute(ps,copyop),
42  _coordOriginMode(ps._coordOriginMode) {}
43 
44 
45  META_StateAttribute(osg, PointSprite, POINTSPRITE);
46 
48  virtual int compare(const StateAttribute& sa) const;
49 
50  virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
51  {
53  return true;
54  }
55 
56  virtual bool checkValidityOfAssociatedModes(osg::State&) const;
57 
58  virtual bool isTextureAttribute() const { return true; }
59 
60  virtual void apply(osg::State& state) const;
61 
63  UPPER_LEFT = GL_UPPER_LEFT,
64  LOWER_LEFT = GL_LOWER_LEFT
65  };
66 
67  inline void setCoordOriginMode(CoordOriginMode mode) { _coordOriginMode = mode; }
68  inline CoordOriginMode getCoordOriginMode() const { return _coordOriginMode; }
69 
70 protected:
71  virtual ~PointSprite();
72 
74 };
75 
76 }
77 
78 #endif
#define OSG_EXPORT
Definition: Export.h:43
#define GL_LOWER_LEFT
Definition: PointSprite.h:27
CoordOriginMode _coordOriginMode
Definition: PointSprite.h:73
#define GL_UPPER_LEFT
Definition: PointSprite.h:28
virtual void usesMode(GLMode mode)=0
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition: PointSprite.h:50
void setCoordOriginMode(CoordOriginMode mode)
Definition: PointSprite.h:67
CoordOriginMode getCoordOriginMode() const
Definition: PointSprite.h:68
#define GL_POINT_SPRITE_ARB
Definition: PointSprite.h:21
#define META_StateAttribute(library, name, type)
Definition: AlphaFunc.h:19
PointSprite(const PointSprite &ps, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition: PointSprite.h:40
virtual bool isTextureAttribute() const
Definition: PointSprite.h:58