This file is indexed.

/usr/include/osg/PrimitiveSet is in libopenscenegraph-dev 3.0.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSG_PRIMITIVESET
#define OSG_PRIMITIVESET 1

#include <osg/GL>
#include <osg/Object>
#include <osg/buffered_value>
#include <osg/Vec2>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/Vec2d>
#include <osg/Vec3d>
#include <osg/Vec4d>
#include <osg/MixinVector>
#include <osg/GL2Extensions>

#include <osg/BufferObject>

#include <vector>

namespace osg {

typedef MixinVector<GLsizei> VectorGLsizei;
typedef MixinVector<GLubyte> VectorGLubyte;
typedef MixinVector<GLushort> VectorGLushort;
typedef MixinVector<GLuint> VectorGLuint;

class State;

/** A \c PrimitiveFunctor is used (in conjunction with
 *  <tt>osg::Drawable::accept (PrimitiveFunctor&)</tt>) to get access to the
 *  primitives that compose the things drawn by OSG.
 *  <p>If \c osg::Drawable::accept() is called with a \c PrimitiveFunctor
 *  parameter, the \c Drawable will "pretend" it is drawing itself, but instead
 *  of calling real OpenGL functions, it will call <tt>PrimitiveFunctor</tt>'s
 *  member functions that "mimic" the OpenGL calls.
 *  <p>Concrete subclasses of \c PrimitiveFunctor must implement these methods
 *  so that they performs whatever they want.
 */
class PrimitiveFunctor
{
public:

    virtual ~PrimitiveFunctor() {}

    /** Sets the array of vertices used to describe the primitives. Somehow
     *  mimics the OpenGL \c glVertexPointer() function.
     */
    virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;

    /** Sets the array of vertices used to describe the primitives. Somehow
     *  mimics the OpenGL \c glVertexPointer() function.
     */
    virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;

    /** Sets the array of vertices used to describe the primitives. Somehow
     *  mimics the OpenGL \c glVertexPointer() function.
     */
    virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;

    /** Sets the array of vertices used to describe the primitives. Somehow
     *  mimics the OpenGL \c glVertexPointer() function.
     */
    virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;

    /** Sets the array of vertices used to describe the primitives. Somehow
     *  mimics the OpenGL \c glVertexPointer() function.
     */
    virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;

    /** Sets the array of vertices used to describe the primitives. Somehow
     *  mimics the OpenGL \c glVertexPointer() function.
     */
    virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;

    /// Mimics the OpenGL \c glDrawArrays() function.
    virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;

    /// Mimics the OpenGL \c glDrawElements() function.
    virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;

    /// Mimics the OpenGL \c glDrawElements() function.
    virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;

    /// Mimics the OpenGL \c glDrawElements() function.
    virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;

    /// Mimics the OpenGL \c glBegin() function.
    virtual void begin(GLenum mode) = 0;

    /// Mimics the OpenGL \c glVertex() "family of functions".
    virtual void vertex(const Vec2& vert) = 0;

    /// Mimics the OpenGL \c glVertex() "family of functions".
    virtual void vertex(const Vec3& vert) = 0;

    /// Mimics the OpenGL \c glVertex() "family of functions".
    virtual void vertex(const Vec4& vert) = 0;

    /// Mimics the OpenGL \c glVertex() "family of functions".
    virtual void vertex(float x,float y) = 0;

    /// Mimics the OpenGL \c glVertex() "family of functions".
    virtual void vertex(float x,float y,float z) = 0;

    /// Mimics the OpenGL \c glVertex() "family of functions".
    virtual void vertex(float x,float y,float z,float w) = 0;

    /// Mimics the OpenGL \c glEnd() function.
    virtual void end() = 0;
};

class PrimitiveIndexFunctor
{
public:

    virtual ~PrimitiveIndexFunctor() {}

    virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
    virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
    virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;

    virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;
    virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;
    virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;

    virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
    virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
    virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
    virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;

    virtual void begin(GLenum mode) = 0;
    virtual void vertex(unsigned int pos) = 0;
    virtual void end() = 0;
};

class DrawElements;

class OSG_EXPORT PrimitiveSet : public BufferData
{
    public:
    
        enum Type
        {
            PrimitiveType,
            DrawArraysPrimitiveType,
            DrawArrayLengthsPrimitiveType,
            DrawElementsUBytePrimitiveType,
            DrawElementsUShortPrimitiveType,
            DrawElementsUIntPrimitiveType
        };

        enum Mode
        {
            POINTS = GL_POINTS,
            LINES = GL_LINES,
            LINE_STRIP = GL_LINE_STRIP,
            LINE_LOOP = GL_LINE_LOOP,
            TRIANGLES = GL_TRIANGLES,
            TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
            TRIANGLE_FAN = GL_TRIANGLE_FAN,
            QUADS = GL_QUADS,
            QUAD_STRIP = GL_QUAD_STRIP,
            POLYGON = GL_POLYGON,
            LINES_ADJACENCY = GL_LINES_ADJACENCY_EXT, 
            LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY_EXT, 
            TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY_EXT, 
            TRIANGLE_STRIP_ADJACENCY = GL_TRIANGLE_STRIP_ADJACENCY_EXT,
            PATCHES = GL_PATCHES
        };

        PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0, int numInstances=0):
            _primitiveType(primType),
            _numInstances(numInstances),
            _mode(mode) {}
    
        PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
            BufferData(prim,copyop),
            _primitiveType(prim._primitiveType),
            _numInstances(prim._numInstances),
            _mode(prim._mode) {}

        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PrimitiveSet*>(obj)!=NULL; }
        virtual const char* libraryName() const { return "osg"; }
        virtual const char* className() const { return "PrimitiveSet"; }
        
        Type                    getType() const { return _primitiveType; }
        virtual const GLvoid*   getDataPointer() const { return 0; }
        virtual unsigned int    getTotalDataSize() const { return 0; }
        virtual bool            supportsBufferObject() const { return false; }

        virtual DrawElements* getDrawElements() { return 0; }
        virtual const DrawElements* getDrawElements() const { return 0; }
            
        void setNumInstances(int n) { _numInstances = n; }
        int getNumInstances() const { return _numInstances; }

        void setMode(GLenum mode) { _mode = mode; }
        GLenum getMode() const { return _mode; }

        virtual void draw(State& state, bool useVertexBufferObjects) const = 0;
        
        virtual void accept(PrimitiveFunctor& functor) const = 0;
        virtual void accept(PrimitiveIndexFunctor& functor) const = 0;
        
        virtual unsigned int index(unsigned int pos) const = 0;
        virtual unsigned int getNumIndices() const = 0;
        virtual void offsetIndices(int offset) = 0;

        virtual unsigned int getNumPrimitives() const; 

        virtual void computeRange() const {}

    protected:

        virtual ~PrimitiveSet() {}

        Type            _primitiveType;
        int             _numInstances;
        GLenum          _mode;
};

class OSG_EXPORT DrawArrays : public PrimitiveSet
{
    public:

        DrawArrays(GLenum mode=0):
            PrimitiveSet(DrawArraysPrimitiveType,mode),
            _first(0),
            _count(0) {}
    
        DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0):
            PrimitiveSet(DrawArraysPrimitiveType, mode, numInstances),
            _first(first),
            _count(count) {}

        DrawArrays(const DrawArrays& da,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
            PrimitiveSet(da,copyop),
            _first(da._first),
            _count(da._count) {}

        virtual Object* cloneType() const { return new DrawArrays(); }
        virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); }        
        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrays*>(obj)!=NULL; }
        virtual const char* libraryName() const { return "osg"; }
        virtual const char* className() const { return "DrawArrays"; }
        

        void set(GLenum mode,GLint first, GLsizei count)
        {
            _mode = mode;
            _first = first;
            _count = count;
        }

        void setFirst(GLint first) { _first = first; }
        GLint getFirst() const { return _first; }
        
        void setCount(GLsizei count) { _count = count; }
        GLsizei getCount() const { return _count; }

        virtual void draw(State& state, bool useVertexBufferObjects) const;
        
        virtual void accept(PrimitiveFunctor& functor) const;
        virtual void accept(PrimitiveIndexFunctor& functor) const;
        
        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(_count); }
        virtual unsigned int index(unsigned int pos) const { return static_cast<unsigned int>(_first)+pos; }
        virtual void offsetIndices(int offset) { _first += offset; }

    protected:

        virtual ~DrawArrays() {}

        GLint   _first;
        GLsizei _count;
};

class OSG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorGLsizei
{
    public:

        typedef VectorGLsizei vector_type;

        DrawArrayLengths(GLenum mode=0):
            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
            _first(0) {}
    
        DrawArrayLengths(const DrawArrayLengths& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
            PrimitiveSet(dal,copyop),
            vector_type(dal),
            _first(dal._first) {}

        DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) : 
            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
            vector_type(ptr,ptr+no),
            _first(first) {}

        DrawArrayLengths(GLenum mode,GLint first, unsigned int no) : 
            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
            vector_type(no),
            _first(first) {}

        DrawArrayLengths(GLenum mode,GLint first) : 
            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
            vector_type(),
            _first(first) {}


        virtual Object* cloneType() const { return new DrawArrayLengths(); }
        virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); }        
        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrayLengths*>(obj)!=NULL; }
        virtual const char* libraryName() const { return "osg"; }
        virtual const char* className() const { return "DrawArrayLengths"; }
        

        void setFirst(GLint first) { _first = first; }
        GLint getFirst() const { return _first; }
        
        virtual void draw(State& state, bool useVertexBufferObjects) const;
        
        virtual void accept(PrimitiveFunctor& functor) const;
        virtual void accept(PrimitiveIndexFunctor& functor) const;
        
        virtual unsigned int getNumIndices() const;
        virtual unsigned int index(unsigned int pos) const { return _first+pos; }
        virtual void offsetIndices(int offset) { _first += offset; }

        virtual unsigned int getNumPrimitives() const;

    protected:

        virtual ~DrawArrayLengths() {}

        GLint   _first;
};

class DrawElements : public PrimitiveSet
{
    public:
        
        DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0):
            PrimitiveSet(primType,mode, numInstances) {}
    
        DrawElements(const DrawElements& copy,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
            PrimitiveSet(copy,copyop) {}


        virtual DrawElements* getDrawElements() { return this; }
        virtual const DrawElements* getDrawElements() const { return this; }

        /** Set the ElementBufferObject.*/
        inline void setElementBufferObject(osg::ElementBufferObject* ebo) { setBufferObject(ebo); }

        /** Get the ElementBufferObject. If no EBO is assigned returns NULL*/
        inline osg::ElementBufferObject* getElementBufferObject() { return dynamic_cast<osg::ElementBufferObject*>(_bufferObject.get()); }

        /** Get the const ElementBufferObject. If no EBO is assigned returns NULL*/
        inline const osg::ElementBufferObject* getElementBufferObject() const { return dynamic_cast<const osg::ElementBufferObject*>(_bufferObject.get()); }

        virtual void reserveElements(unsigned int numIndices) = 0;
        virtual void setElement(unsigned int, unsigned int) = 0;
        virtual unsigned int getElement(unsigned int) = 0;
        virtual void addElement(unsigned int) = 0;

    protected:

        virtual ~DrawElements() {}
};

class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte
{
    public:
    
        typedef VectorGLubyte vector_type;

        DrawElementsUByte(GLenum mode=0):
            DrawElements(DrawElementsUBytePrimitiveType,mode) {}
    
        DrawElementsUByte(const DrawElementsUByte& array, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
            DrawElements(array,copyop),
            vector_type(array) {}

        /**
         * \param no Number of intended elements. This will be the size of the underlying vector.
         */
        DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte* ptr, int numInstances=0) : 
            DrawElements(DrawElementsUBytePrimitiveType,mode,numInstances),
            vector_type(ptr,ptr+no) {}

        /**
         * \param no Number of intended elements. This will be the size of the underlying vector.
         */
        DrawElementsUByte(GLenum mode, unsigned int no) : 
            DrawElements(DrawElementsUBytePrimitiveType,mode),
            vector_type(no) {}

        virtual Object* cloneType() const { return new DrawElementsUByte(); }
        virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); }        
        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUByte*>(obj)!=NULL; }
        virtual const char* libraryName() const { return "osg"; }
        virtual const char* className() const { return "DrawElementsUByte"; }

        virtual const GLvoid*   getDataPointer() const { return empty()?0:&front(); }
        virtual unsigned int    getTotalDataSize() const { return static_cast<unsigned int>(size()); }
        virtual bool            supportsBufferObject() const { return false; }

        virtual void draw(State& state, bool useVertexBufferObjects) const ;
        
        virtual void accept(PrimitiveFunctor& functor) const;
        virtual void accept(PrimitiveIndexFunctor& functor) const;

        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
        virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
        virtual void offsetIndices(int offset);
        
        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
        virtual void setElement(unsigned int i, unsigned int v)  { (*this)[i] = v; }
        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } 
        virtual void addElement(unsigned int v) { push_back(GLubyte(v)); } 

    protected:

        virtual ~DrawElementsUByte();
};


class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort
{
    public:

        typedef VectorGLushort vector_type;

        DrawElementsUShort(GLenum mode=0):
            DrawElements(DrawElementsUShortPrimitiveType,mode) {}
    
        DrawElementsUShort(const DrawElementsUShort& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
            DrawElements(array,copyop),
            vector_type(array) {}

        /**
         * \param no Number of intended elements. This will be the size of the underlying vector.
         */
        DrawElementsUShort(GLenum mode, unsigned int no, const GLushort* ptr, int numInstances=0) : 
            DrawElements(DrawElementsUShortPrimitiveType,mode,numInstances),
            vector_type(ptr,ptr+no) {}

        /**
         * \param no Number of intended elements. This will be the size of the underlying vector.
         */
        DrawElementsUShort(GLenum mode, unsigned int no) : 
            DrawElements(DrawElementsUShortPrimitiveType,mode),
            vector_type(no) {}

        template <class InputIterator>
        DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) : 
            DrawElements(DrawElementsUShortPrimitiveType,mode),
            vector_type(first,last) {}

        virtual Object* cloneType() const { return new DrawElementsUShort(); }
        virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); }        
        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUShort*>(obj)!=NULL; }
        virtual const char* libraryName() const { return "osg"; }
        virtual const char* className() const { return "DrawElementsUShort"; }

        virtual const GLvoid*   getDataPointer() const { return empty()?0:&front(); }
        virtual unsigned int    getTotalDataSize() const { return 2u*static_cast<unsigned int>(size()); }
        virtual bool            supportsBufferObject() const { return false; }

        virtual void draw(State& state, bool useVertexBufferObjects) const;
        
        virtual void accept(PrimitiveFunctor& functor) const;
        virtual void accept(PrimitiveIndexFunctor& functor) const;

        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
        virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
        virtual void offsetIndices(int offset);

        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
        virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
        virtual void addElement(unsigned int v) { push_back(GLushort(v)); }

    protected:

        virtual ~DrawElementsUShort();
};

class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint
{
    public:

        typedef VectorGLuint vector_type;

        DrawElementsUInt(GLenum mode=0):
            DrawElements(DrawElementsUIntPrimitiveType,mode) {}
    
        DrawElementsUInt(const DrawElementsUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
            DrawElements(array,copyop),
            vector_type(array) {}

        /**
         * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used.
         * \param no Number of intended elements. This will be the size of the underlying vector.
         */
        DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) : 
            DrawElements(DrawElementsUIntPrimitiveType,mode,numInstances),
            vector_type(ptr,ptr+no) {}

        /**
         * \param no Number of intended elements. This will be the size of the underlying vector.
         */
        DrawElementsUInt(GLenum mode, unsigned int no) : 
            DrawElements(DrawElementsUIntPrimitiveType,mode),
            vector_type(no) {}

        template <class InputIterator>
        DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) : 
            DrawElements(DrawElementsUIntPrimitiveType,mode),
            vector_type(first,last) {}

        virtual Object* cloneType() const { return new DrawElementsUInt(); }
        virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); }        
        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUInt*>(obj)!=NULL; }
        virtual const char* libraryName() const { return "osg"; }
        virtual const char* className() const { return "DrawElementsUInt"; }

        virtual const GLvoid*   getDataPointer() const { return empty()?0:&front(); }
        virtual unsigned int    getTotalDataSize() const { return 4u*static_cast<unsigned int>(size()); }
        virtual bool            supportsBufferObject() const { return false; }

        virtual void draw(State& state, bool useVertexBufferObjects) const;
        
        virtual void accept(PrimitiveFunctor& functor) const;
        virtual void accept(PrimitiveIndexFunctor& functor) const;

        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
        virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
        virtual void offsetIndices(int offset);

        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
        virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
        virtual void addElement(unsigned int v) { push_back(GLuint(v)); }

    protected:

        virtual ~DrawElementsUInt();
};

}

#endif