125
125
virtual const Geometry* asGeometry() const { return 0; }
128
/** Compute the DataVariance based on an assestment of callback etc.*/
128
/** Compute the DataVariance based on an assessment of callback etc.*/
129
129
virtual void computeDataVariance();
310
310
virtual void resizeGLObjectBuffers(unsigned int maxSize);
312
312
/** If State is non-zero, this function releases OpenGL objects for
313
* the specified graphics context. Otherwise, releases OpenGL objexts
313
* the specified graphics context. Otherwise, releases OpenGL objects
314
314
* for all graphics contexts. */
315
315
virtual void releaseGLObjects(State* state=0) const;
420
420
/** drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that
421
421
* must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable.
422
422
* drawImplementation(RenderInfo&) is called from the draw(RenderInfo&) method, with the draw method handling management of OpenGL display lists,
423
* and drawImplementation(RenderInfo&) handling the actuall drawing itself.
424
* @param renderInfo The osg::RenderInfo object that encapulates the current rendering information including the osg::State OpenGL state for the current graphics context. */
423
* and drawImplementation(RenderInfo&) handling the actual drawing itself.
424
* @param renderInfo The osg::RenderInfo object that encapsulates the current rendering information including the osg::State OpenGL state for the current graphics context. */
425
425
virtual void drawImplementation(RenderInfo& renderInfo) const = 0;
444
444
* in the OpenGL context related to contextID.*/
445
445
static void flushAllDeletedDisplayLists(unsigned int contextID);
447
/** Flush all the cached display list which need to be deleted
448
* in the OpenGL context related to contextID.
449
* Note, unlike flush no OpenGL calls are made, instead the handles are all removed.
450
* this call is useful for when an OpenGL context has been destroyed. */
451
static void discardAllDeletedDisplayLists(unsigned int contextID);
447
453
/** Flush the cached display list which need to be deleted
448
454
* in the OpenGL context related to contextID.*/
449
455
static void flushDeletedDisplayLists(unsigned int contextID,double& availableTime);
451
/** Use deleteVertexBufferObject instead of glDeleteBuffers to allow
452
* OpenGL buffer objects to be cached until they can be deleted
453
* by the OpenGL context in which they were created, specified
455
static void deleteVertexBufferObject(unsigned int contextID,GLuint globj);
457
/** Flush all the cached vertex buffer objects which need to be deleted
458
* in the OpenGL context related to contextID.*/
459
static void flushDeletedVertexBufferObjects(unsigned int contextID,double currentTime, double& availableTime);
461
457
typedef unsigned int AttributeType;
463
459
enum AttributeTypes
479
475
TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5,
480
476
TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6,
481
477
TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7
482
// only eight texture coord examples provided here, but underlying code can handle any no of texure units,
478
// only eight texture coord examples provided here, but underlying code can handle any no of texture units,
483
479
// simply co them as (TEXTURE_COORDS_0+unit).
501
497
virtual void apply(AttributeType,unsigned int,Vec3*) {}
502
498
virtual void apply(AttributeType,unsigned int,Vec4*) {}
503
499
virtual void apply(AttributeType,unsigned int,Vec4ub*) {}
501
virtual void apply(AttributeType,unsigned int,double*) {}
502
virtual void apply(AttributeType,unsigned int,Vec2d*) {}
503
virtual void apply(AttributeType,unsigned int,Vec3d*) {}
504
virtual void apply(AttributeType,unsigned int,Vec4d*) {}
532
533
virtual void apply(AttributeType,unsigned int,const Vec3*) {}
533
534
virtual void apply(AttributeType,unsigned int,const Vec4*) {}
534
535
virtual void apply(AttributeType,unsigned int,const Vec4ub*) {}
537
virtual void apply(AttributeType,unsigned int,const double*) {}
538
virtual void apply(AttributeType,unsigned int,const Vec2d*) {}
539
virtual void apply(AttributeType,unsigned int,const Vec3d*) {}
540
virtual void apply(AttributeType,unsigned int,const Vec4d*) {}
537
543
/** Return true if the Drawable subclass supports accept(ConstAttributeFunctor&).*/
608
614
void glMultiTexCoord3fv(GLenum target,const GLfloat* coord) const;
609
615
void glMultiTexCoord4fv(GLenum target,const GLfloat* coord) const;
617
void glMultiTexCoord1d(GLenum target,GLdouble coord) const;
618
void glMultiTexCoord2dv(GLenum target,const GLdouble* coord) const;
619
void glMultiTexCoord3dv(GLenum target,const GLdouble* coord) const;
620
void glMultiTexCoord4dv(GLenum target,const GLdouble* coord) const;
611
622
void glVertexAttrib1s(unsigned int index, GLshort s) const;
612
623
void glVertexAttrib1f(unsigned int index, GLfloat f) const;
624
void glVertexAttrib1d(unsigned int index, GLdouble f) const;
613
625
void glVertexAttrib2fv(unsigned int index, const GLfloat * v) const;
614
626
void glVertexAttrib3fv(unsigned int index, const GLfloat * v) const;
615
627
void glVertexAttrib4fv(unsigned int index, const GLfloat * v) const;
628
void glVertexAttrib2dv(unsigned int index, const GLdouble * v) const;
629
void glVertexAttrib3dv(unsigned int index, const GLdouble * v) const;
630
void glVertexAttrib4dv(unsigned int index, const GLdouble * v) const;
616
631
void glVertexAttrib4ubv(unsigned int index, const GLubyte * v) const;
617
632
void glVertexAttrib4Nubv(unsigned int index, const GLubyte * v) const;
655
670
typedef void (APIENTRY * VertexAttrib1sProc) (unsigned int index, GLshort s);
656
671
typedef void (APIENTRY * VertexAttrib1fProc) (unsigned int index, GLfloat f);
672
typedef void (APIENTRY * VertexAttrib1dProc) (unsigned int index, GLdouble f);
657
673
typedef void (APIENTRY * VertexAttribfvProc) (unsigned int index, const GLfloat * v);
674
typedef void (APIENTRY * VertexAttribdvProc) (unsigned int index, const GLdouble * v);
658
675
typedef void (APIENTRY * VertexAttribubvProc) (unsigned int index, const GLubyte * v);
660
677
typedef void (APIENTRY * SecondaryColor3ubvProc) (const GLubyte* coord);
663
680
typedef void (APIENTRY * MultiTexCoord1fProc) (GLenum target,GLfloat coord);
664
681
typedef void (APIENTRY * MultiTexCoordfvProc) (GLenum target,const GLfloat* coord);
682
typedef void (APIENTRY * MultiTexCoord1dProc) (GLenum target,GLdouble coord);
683
typedef void (APIENTRY * MultiTexCoorddvProc) (GLenum target,const GLdouble* coord);
667
686
typedef void (APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers);
713
732
VertexAttrib1sProc _glVertexAttrib1s;
714
733
VertexAttrib1fProc _glVertexAttrib1f;
734
VertexAttrib1dProc _glVertexAttrib1d;
715
735
VertexAttribfvProc _glVertexAttrib2fv;
716
736
VertexAttribfvProc _glVertexAttrib3fv;
717
737
VertexAttribfvProc _glVertexAttrib4fv;
738
VertexAttribdvProc _glVertexAttrib2dv;
739
VertexAttribdvProc _glVertexAttrib3dv;
740
VertexAttribdvProc _glVertexAttrib4dv;
718
741
VertexAttribubvProc _glVertexAttrib4ubv;
719
742
VertexAttribubvProc _glVertexAttrib4Nubv;
722
745
MultiTexCoordfvProc _glMultiTexCoord2fv;
723
746
MultiTexCoordfvProc _glMultiTexCoord3fv;
724
747
MultiTexCoordfvProc _glMultiTexCoord4fv;
748
MultiTexCoord1dProc _glMultiTexCoord1d;
749
MultiTexCoorddvProc _glMultiTexCoord2dv;
750
MultiTexCoorddvProc _glMultiTexCoord3dv;
751
MultiTexCoorddvProc _glMultiTexCoord4dv;
726
753
GenBuffersProc _glGenBuffers;
727
754
BindBufferProc _glBindBuffer;