Show
Ignore:
Timestamp:
01/06/09 15:55:49 (6 years ago)
Author:
robert
Message:

Added support for primitive instancing

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/State

    r7648 r9447  
    460460            _currentPBO = 0; 
    461461        } 
     462         
     463         
     464        inline void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount) 
     465        { 
     466            if (primcount>=1 && _glDrawArraysInstanced!=0) _glDrawArraysInstanced(mode, first, count, primcount); 
     467            else glDrawArrays(mode, first, count); 
     468        } 
     469     
     470        inline void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount ) 
     471        { 
     472            if (primcount>=1 && _glDrawElementsInstanced!=0) _glDrawElementsInstanced(mode, count, type, indices, primcount); 
     473            else glDrawElements(mode, count, type, indices); 
     474        } 
     475 
    462476 
    463477        /** Wrapper around glInterleavedArrays(..). 
     
    12941308        typedef void (APIENTRY * DisableVertexAttribProc) (unsigned int); 
    12951309        typedef void (APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); 
    1296  
     1310         
     1311        typedef void (APIENTRY * DrawArraysInstancedProc)( GLenum mode, GLint first, GLsizei count, GLsizei primcount ); 
     1312        typedef void (APIENTRY * DrawElementsInstancedProc)( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount ); 
    12971313 
    12981314        bool                        _extensionProcsInitialized; 
     
    13071323        DisableVertexAttribProc     _glDisableVertexAttribArray; 
    13081324        BindBufferProc              _glBindBuffer; 
    1309  
     1325        DrawArraysInstancedProc     _glDrawArraysInstanced; 
     1326        DrawElementsInstancedProc   _glDrawElementsInstanced; 
    13101327 
    13111328        unsigned int                                            _dynamicObjectCount;