Implemented better handling of VertexBufferObjects and ElementBufferObjects in osgText

This commit is contained in:
Robert Osfield
2017-03-03 18:31:51 +00:00
parent 59931d1591
commit b88be0fbda
6 changed files with 189 additions and 64 deletions

View File

@@ -280,9 +280,6 @@ public:
virtual void accept(osg::PrimitiveFunctor& pf) const;
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);

View File

@@ -91,10 +91,6 @@ class OSGTEXT_EXPORT Text3D : public osgText::TextBase
/** accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.*/
virtual void accept(osg::PrimitiveFunctor& pf) const;
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);

View File

@@ -253,8 +253,10 @@ public:
/** Get the number of wrapped lines - only valid after computeGlyphRepresentation() has been called, returns 0 otherwise */
unsigned int getLineCount() const { return _lineCount; }
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Immediately compile this \c Drawable into an OpenGL Display List/VertexBufferObjects.
* @note Operation is ignored if \c _useDisplayList is \c false or VertexBufferObjects are not used.
*/
virtual void compileGLObjects(osg::RenderInfo& renderInfo) const;
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);
@@ -278,6 +280,12 @@ protected:
virtual ~TextBase();
void initArraysAndBuffers();
#ifdef NEW_APPROACH
osg::VertexArrayState* createVertexArrayState(osg::RenderInfo& renderInfo) const;
#endif
bool computeMatrix(osg::Matrix& matrix, osg::State* state=0) const;
void positionCursor(const osg::Vec2 & endOfLine_coords, osg::Vec2 & cursor, unsigned int linelength);
@@ -327,6 +335,9 @@ protected:
void setupDecoration();
osg::ref_ptr<osg::VertexBufferObject> _vbo;
osg::ref_ptr<osg::ElementBufferObject> _ebo;
Coords _coords;
Coords _normals;
ColorCoords _colorCoords;