From Farshid Lashkari, "This patch adds a CoordOriginMode to the osg::PointSprite attribute.
The mode needs to be changed to LOWER_LEFT when rendering point sprites to pbuffers or FBOs, otherwise the points will be transformed on the CPU."
This commit is contained in:
@@ -94,6 +94,7 @@ class OSG_EXPORT Point : public StateAttribute
|
||||
void setPointParametersSupported(bool flag) { _isPointParametersSupported=flag; }
|
||||
bool isPointParametersSupported() const { return _isPointParametersSupported; }
|
||||
|
||||
void glPointParameteri(GLenum pname, GLint param) const;
|
||||
void glPointParameterf(GLenum pname, GLfloat param) const;
|
||||
void glPointParameterfv(GLenum pname, const GLfloat *params) const;
|
||||
|
||||
@@ -103,6 +104,7 @@ class OSG_EXPORT Point : public StateAttribute
|
||||
|
||||
bool _isPointParametersSupported;
|
||||
|
||||
void* _glPointParameteri;
|
||||
void* _glPointParameterf;
|
||||
void* _glPointParameterfv;
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef GL_ARB_point_sprite
|
||||
#define GL_POINT_SPRITE_ARB 0x8861
|
||||
#define GL_COORD_REPLACE_ARB 0x8862
|
||||
#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
|
||||
#define GL_LOWER_LEFT 0x8CA1
|
||||
#define GL_UPPER_LEFT 0x8CA2
|
||||
#endif
|
||||
|
||||
namespace osg {
|
||||
@@ -28,11 +31,12 @@ namespace osg {
|
||||
class OSG_EXPORT PointSprite : public osg::StateAttribute {
|
||||
public:
|
||||
|
||||
PointSprite() {}
|
||||
PointSprite();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
PointSprite(const PointSprite& texenv,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(texenv,copyop) {}
|
||||
PointSprite(const PointSprite& ps,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(ps,copyop),
|
||||
_coordOriginMode(ps._coordOriginMode) {}
|
||||
|
||||
|
||||
META_StateAttribute(osg, PointSprite, POINTSPRITE);
|
||||
@@ -53,9 +57,19 @@ public:
|
||||
virtual void apply(osg::State& state) const;
|
||||
|
||||
static bool isPointSpriteSupported(unsigned int context);
|
||||
|
||||
enum CoordOriginMode {
|
||||
UPPER_LEFT = GL_UPPER_LEFT,
|
||||
LOWER_LEFT = GL_LOWER_LEFT
|
||||
};
|
||||
|
||||
inline void setCoordOriginMode(CoordOriginMode mode) { _coordOriginMode = mode; }
|
||||
inline CoordOriginMode getCoordOriginMode() const { return _coordOriginMode; }
|
||||
|
||||
protected:
|
||||
virtual ~PointSprite( void ) {}
|
||||
virtual ~PointSprite();
|
||||
|
||||
CoordOriginMode _coordOriginMode;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user