OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrimitiveSet.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSG_PRIMITIVESET
15 #define OSG_PRIMITIVESET 1
16 
17 #include <osg/GL>
18 #include <osg/Object>
19 #include <osg/buffered_value>
20 #include <osg/Vec2>
21 #include <osg/Vec3>
22 #include <osg/Vec4>
23 #include <osg/Vec2d>
24 #include <osg/Vec3d>
25 #include <osg/Vec4d>
26 #include <osg/MixinVector>
27 
28 #include <osg/BufferObject>
29 
30 #include <vector>
31 
32 namespace osg {
33 
38 
39 class State;
40 
52 {
53 public:
54 
55  virtual ~PrimitiveFunctor() {}
56 
60  virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
61 
65  virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
66 
70  virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
71 
75  virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;
76 
80  virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;
81 
85  virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;
86 
88  virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
89 
91  virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
92 
94  virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
95 
97  virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
98 
100  virtual void begin(GLenum mode) = 0;
101 
103  virtual void vertex(const Vec2& vert) = 0;
104 
106  virtual void vertex(const Vec3& vert) = 0;
107 
109  virtual void vertex(const Vec4& vert) = 0;
110 
112  virtual void vertex(float x,float y) = 0;
113 
115  virtual void vertex(float x,float y,float z) = 0;
116 
118  virtual void vertex(float x,float y,float z,float w) = 0;
119 
121  virtual void end() = 0;
122 
124  {
125  setVertexArray(_vertexCache.size(),&_vertexCache.front());
126  }
127 
128  std::vector<Vec3> _vertexCache;
130 };
131 
133 {
134 public:
135 
137 
138  virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
139  virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
140  virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
141 
142  virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;
143  virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;
144  virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;
145 
146  virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
147  virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
148  virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
149  virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
150 
151  virtual void begin(GLenum mode) = 0;
152  virtual void vertex(unsigned int pos) = 0;
153  virtual void end() = 0;
154 
156  {
157  setVertexArray(_vertexCache.size(),&_vertexCache.front());
158  }
159 
160  std::vector<Vec3> _vertexCache;
162 };
163 
164 class DrawElements;
165 
167 {
168  public:
169 
170  enum Type
171  {
177  DrawElementsUIntPrimitiveType
178  };
179 
180  enum Mode
181  {
182  POINTS = GL_POINTS,
183  LINES = GL_LINES,
184  LINE_STRIP = GL_LINE_STRIP,
185  LINE_LOOP = GL_LINE_LOOP,
186  TRIANGLES = GL_TRIANGLES,
187  TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
188  TRIANGLE_FAN = GL_TRIANGLE_FAN,
189  QUADS = GL_QUADS,
190  QUAD_STRIP = GL_QUAD_STRIP,
191  POLYGON = GL_POLYGON,
192  LINES_ADJACENCY = GL_LINES_ADJACENCY,
193  LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY,
194  TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY,
195  TRIANGLE_STRIP_ADJACENCY = GL_TRIANGLE_STRIP_ADJACENCY,
196  PATCHES = GL_PATCHES
197  };
198 
199  PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0, int numInstances=0):
200  _primitiveType(primType),
201  _numInstances(numInstances),
202  _mode(mode) {}
203 
205  BufferData(prim,copyop),
206  _primitiveType(prim._primitiveType),
207  _numInstances(prim._numInstances),
208  _mode(prim._mode) {}
209 
210  virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PrimitiveSet*>(obj)!=NULL; }
211  virtual const char* libraryName() const { return "osg"; }
212  virtual const char* className() const { return "PrimitiveSet"; }
213 
214  Type getType() const { return _primitiveType; }
215 
216  virtual osg::PrimitiveSet* asPrimitiveSet() { return this; }
217  virtual const osg::PrimitiveSet* asPrimitiveSet() const { return this; }
218 
219  virtual const GLvoid* getDataPointer() const { return 0; }
220  virtual unsigned int getTotalDataSize() const { return 0; }
221  virtual bool supportsBufferObject() const { return false; }
222 
223  virtual DrawElements* getDrawElements() { return 0; }
224  virtual const DrawElements* getDrawElements() const { return 0; }
225 
226  void setNumInstances(int n) { _numInstances = n; }
227  int getNumInstances() const { return _numInstances; }
228 
229  void setMode(GLenum mode) { _mode = mode; }
230  GLenum getMode() const { return _mode; }
231 
232  virtual void draw(State& state, bool useVertexBufferObjects) const = 0;
233 
234  virtual void accept(PrimitiveFunctor& functor) const = 0;
235  virtual void accept(PrimitiveIndexFunctor& functor) const = 0;
236 
237  virtual unsigned int index(unsigned int pos) const = 0;
238  virtual unsigned int getNumIndices() const = 0;
239  virtual void offsetIndices(int offset) = 0;
240 
241  virtual unsigned int getNumPrimitives() const;
242 
243  virtual void computeRange() const {}
244 
245  protected:
246 
247  virtual ~PrimitiveSet() {}
248 
251  GLenum _mode;
252 };
253 
255 {
256  public:
257 
258  DrawArrays(GLenum mode=0):
259  PrimitiveSet(DrawArraysPrimitiveType,mode),
260  _first(0),
261  _count(0) {}
262 
263  DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0):
264  PrimitiveSet(DrawArraysPrimitiveType, mode, numInstances),
265  _first(first),
266  _count(count) {}
267 
269  PrimitiveSet(da,copyop),
270  _first(da._first),
271  _count(da._count) {}
272 
273  virtual Object* cloneType() const { return new DrawArrays(); }
274  virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); }
275  virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrays*>(obj)!=NULL; }
276  virtual const char* libraryName() const { return "osg"; }
277  virtual const char* className() const { return "DrawArrays"; }
278 
279 
280  void set(GLenum mode,GLint first, GLsizei count)
281  {
282  _mode = mode;
283  _first = first;
284  _count = count;
285  }
286 
287  void setFirst(GLint first) { _first = first; }
288  GLint getFirst() const { return _first; }
289 
290  void setCount(GLsizei count) { _count = count; }
291  GLsizei getCount() const { return _count; }
292 
293  virtual void draw(State& state, bool useVertexBufferObjects) const;
294 
295  virtual void accept(PrimitiveFunctor& functor) const;
296  virtual void accept(PrimitiveIndexFunctor& functor) const;
297 
298  virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(_count); }
299  virtual unsigned int index(unsigned int pos) const { return static_cast<unsigned int>(_first)+pos; }
300  virtual void offsetIndices(int offset) { _first += offset; }
301 
302  protected:
303 
304  virtual ~DrawArrays() {}
305 
306  GLint _first;
307  GLsizei _count;
308 };
309 
310 class OSG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorGLsizei
311 {
312  public:
313 
314  typedef VectorGLsizei vector_type;
315 
316  DrawArrayLengths(GLenum mode=0):
317  PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
318  _first(0) {}
319 
321  PrimitiveSet(dal,copyop),
322  vector_type(dal),
323  _first(dal._first) {}
324 
325  DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) :
326  PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
327  vector_type(ptr,ptr+no),
328  _first(first) {}
329 
330  DrawArrayLengths(GLenum mode,GLint first, unsigned int no) :
331  PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
332  vector_type(no),
333  _first(first) {}
334 
335  DrawArrayLengths(GLenum mode,GLint first) :
336  PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
337  vector_type(),
338  _first(first) {}
339 
340 
341  virtual Object* cloneType() const { return new DrawArrayLengths(); }
342  virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); }
343  virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrayLengths*>(obj)!=NULL; }
344  virtual const char* libraryName() const { return "osg"; }
345  virtual const char* className() const { return "DrawArrayLengths"; }
346 
347 
348  void setFirst(GLint first) { _first = first; }
349  GLint getFirst() const { return _first; }
350 
351  virtual void draw(State& state, bool useVertexBufferObjects) const;
352 
353  virtual void accept(PrimitiveFunctor& functor) const;
354  virtual void accept(PrimitiveIndexFunctor& functor) const;
355 
356  virtual unsigned int getNumIndices() const;
357  virtual unsigned int index(unsigned int pos) const { return _first+pos; }
358  virtual void offsetIndices(int offset) { _first += offset; }
359 
360  virtual unsigned int getNumPrimitives() const;
361 
362  protected:
363 
364  virtual ~DrawArrayLengths() {}
365 
366  GLint _first;
367 };
368 
370 {
371  public:
372 
373  DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0):
374  PrimitiveSet(primType,mode, numInstances) {}
375 
377  PrimitiveSet(copy,copyop) {}
378 
379 
380  virtual DrawElements* getDrawElements() { return this; }
381  virtual const DrawElements* getDrawElements() const { return this; }
382 
385 
388 
390  inline const osg::ElementBufferObject* getElementBufferObject() const { return dynamic_cast<const osg::ElementBufferObject*>(_bufferObject.get()); }
391 
392  virtual GLenum getDataType() = 0;
393  virtual void resizeElements(unsigned int numIndices) = 0;
394  virtual void reserveElements(unsigned int numIndices) = 0;
395  virtual void setElement(unsigned int, unsigned int) = 0;
396  virtual unsigned int getElement(unsigned int) = 0;
397  virtual void addElement(unsigned int) = 0;
398 
399  protected:
400 
401  virtual ~DrawElements() {}
402 };
403 
404 class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte
405 {
406  public:
407 
408  typedef VectorGLubyte vector_type;
409 
410  DrawElementsUByte(GLenum mode=0):
411  DrawElements(DrawElementsUBytePrimitiveType,mode) {}
412 
414  DrawElements(array,copyop),
415  vector_type(array) {}
416 
420  DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte* ptr, int numInstances=0) :
421  DrawElements(DrawElementsUBytePrimitiveType,mode,numInstances),
422  vector_type(ptr,ptr+no) {}
423 
427  DrawElementsUByte(GLenum mode, unsigned int no) :
428  DrawElements(DrawElementsUBytePrimitiveType,mode),
429  vector_type(no) {}
430 
431  virtual Object* cloneType() const { return new DrawElementsUByte(); }
432  virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); }
433  virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUByte*>(obj)!=NULL; }
434  virtual const char* libraryName() const { return "osg"; }
435  virtual const char* className() const { return "DrawElementsUByte"; }
436 
437  virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
438  virtual unsigned int getTotalDataSize() const { return static_cast<unsigned int>(size()); }
439  virtual bool supportsBufferObject() const { return false; }
440 
441  virtual void draw(State& state, bool useVertexBufferObjects) const ;
442 
443  virtual void accept(PrimitiveFunctor& functor) const;
444  virtual void accept(PrimitiveIndexFunctor& functor) const;
445 
446  virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
447  virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
448  virtual void offsetIndices(int offset);
449 
450  virtual GLenum getDataType() { return GL_UNSIGNED_BYTE; }
451  virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
452  virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
453  virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
454  virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
455  virtual void addElement(unsigned int v) { push_back(GLubyte(v)); }
456 
457  protected:
458 
459  virtual ~DrawElementsUByte();
460 };
461 
462 
463 class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort
464 {
465  public:
466 
467  typedef VectorGLushort vector_type;
468 
469  DrawElementsUShort(GLenum mode=0):
470  DrawElements(DrawElementsUShortPrimitiveType,mode) {}
471 
473  DrawElements(array,copyop),
474  vector_type(array) {}
475 
479  DrawElementsUShort(GLenum mode, unsigned int no, const GLushort* ptr, int numInstances=0) :
480  DrawElements(DrawElementsUShortPrimitiveType,mode,numInstances),
481  vector_type(ptr,ptr+no) {}
482 
486  DrawElementsUShort(GLenum mode, unsigned int no) :
487  DrawElements(DrawElementsUShortPrimitiveType,mode),
488  vector_type(no) {}
489 
490  template <class InputIterator>
491  DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) :
492  DrawElements(DrawElementsUShortPrimitiveType,mode),
493  vector_type(first,last) {}
494 
495  virtual Object* cloneType() const { return new DrawElementsUShort(); }
496  virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); }
497  virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUShort*>(obj)!=NULL; }
498  virtual const char* libraryName() const { return "osg"; }
499  virtual const char* className() const { return "DrawElementsUShort"; }
500 
501  virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
502  virtual unsigned int getTotalDataSize() const { return 2u*static_cast<unsigned int>(size()); }
503  virtual bool supportsBufferObject() const { return false; }
504 
505  virtual void draw(State& state, bool useVertexBufferObjects) const;
506 
507  virtual void accept(PrimitiveFunctor& functor) const;
508  virtual void accept(PrimitiveIndexFunctor& functor) const;
509 
510  virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
511  virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
512  virtual void offsetIndices(int offset);
513 
514  virtual GLenum getDataType() { return GL_UNSIGNED_SHORT; }
515  virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
516  virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
517  virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
518  virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
519  virtual void addElement(unsigned int v) { push_back(GLushort(v)); }
520 
521  protected:
522 
523  virtual ~DrawElementsUShort();
524 };
525 
526 class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint
527 {
528  public:
529 
530  typedef VectorGLuint vector_type;
531 
532  DrawElementsUInt(GLenum mode=0):
533  DrawElements(DrawElementsUIntPrimitiveType,mode) {}
534 
536  DrawElements(array,copyop),
537  vector_type(array) {}
538 
543  DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) :
544  DrawElements(DrawElementsUIntPrimitiveType,mode,numInstances),
545  vector_type(ptr,ptr+no) {}
546 
550  DrawElementsUInt(GLenum mode, unsigned int no) :
551  DrawElements(DrawElementsUIntPrimitiveType,mode),
552  vector_type(no) {}
553 
554  template <class InputIterator>
555  DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) :
556  DrawElements(DrawElementsUIntPrimitiveType,mode),
557  vector_type(first,last) {}
558 
559  virtual Object* cloneType() const { return new DrawElementsUInt(); }
560  virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); }
561  virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUInt*>(obj)!=NULL; }
562  virtual const char* libraryName() const { return "osg"; }
563  virtual const char* className() const { return "DrawElementsUInt"; }
564 
565  virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
566  virtual unsigned int getTotalDataSize() const { return 4u*static_cast<unsigned int>(size()); }
567  virtual bool supportsBufferObject() const { return false; }
568 
569  virtual void draw(State& state, bool useVertexBufferObjects) const;
570 
571  virtual void accept(PrimitiveFunctor& functor) const;
572  virtual void accept(PrimitiveIndexFunctor& functor) const;
573 
574  virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
575  virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
576  virtual void offsetIndices(int offset);
577 
578  virtual GLenum getDataType() { return GL_UNSIGNED_INT; }
579  virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
580  virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
581  virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
582  virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
583  virtual void addElement(unsigned int v) { push_back(GLuint(v)); }
584 
585  protected:
586 
587  virtual ~DrawElementsUInt();
588 };
589 
590 }
591 
592 #endif
#define GL_TRIANGLE_STRIP_ADJACENCY
Definition: GLDefines.h:209
Type getType() const
Definition: PrimitiveSet.h:214
virtual unsigned int getElement(unsigned int i)
Definition: PrimitiveSet.h:518
virtual void reserveElements(unsigned int numIndices)
Definition: PrimitiveSet.h:516
#define OSG_EXPORT
Definition: Export.h:43
virtual const char * className() const
Definition: PrimitiveSet.h:277
std::vector< Vec3 > _vertexCache
Definition: PrimitiveSet.h:160
virtual unsigned int getNumIndices() const
Definition: PrimitiveSet.h:446
virtual const char * className() const
Definition: PrimitiveSet.h:563
#define NULL
Definition: Export.h:59
virtual Object * cloneType() const
Definition: PrimitiveSet.h:341
VectorGLuint vector_type
Definition: PrimitiveSet.h:530
virtual void reserveElements(unsigned int numIndices)
Definition: PrimitiveSet.h:580
virtual bool isSameKindAs(const Object *obj) const
Definition: PrimitiveSet.h:275
DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei *ptr)
Definition: PrimitiveSet.h:325
virtual ~DrawElements()
Definition: PrimitiveSet.h:401
virtual void setElement(unsigned int, unsigned int)=0
virtual void drawArrays(GLenum mode, GLint first, GLsizei count)=0
virtual Object * cloneType() const
Definition: PrimitiveSet.h:273
virtual void end()=0
Mimics the OpenGL glEnd() function.
DrawArrayLengths(const DrawArrayLengths &dal, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PrimitiveSet.h:320
virtual void setElement(unsigned int i, unsigned int v)
Definition: PrimitiveSet.h:581
virtual bool isSameKindAs(const Object *obj) const
Definition: PrimitiveSet.h:433
std::vector< Vec3 > _vertexCache
Definition: PrimitiveSet.h:128
virtual void vertex(unsigned int pos)=0
DrawElementsUInt(GLenum mode, unsigned int no)
Definition: PrimitiveSet.h:550
virtual void drawElements(GLenum mode, GLsizei count, const GLubyte *indices)=0
virtual GLenum getDataType()
Definition: PrimitiveSet.h:450
virtual Object * cloneType() const
Definition: PrimitiveSet.h:431
DrawArrayLengths(GLenum mode, GLint first, unsigned int no)
Definition: PrimitiveSet.h:330
virtual void drawElements(GLenum mode, GLsizei count, const GLubyte *indices)=0
Mimics the OpenGL glDrawElements() function.
virtual void addElement(unsigned int)=0
void setBufferObject(BufferObject *bufferObject)
virtual const DrawElements * getDrawElements() const
Definition: PrimitiveSet.h:381
void setElementBufferObject(osg::ElementBufferObject *ebo)
Definition: PrimitiveSet.h:384
#define GL_PATCHES
Definition: GLDefines.h:219
virtual unsigned int index(unsigned int pos) const
Definition: PrimitiveSet.h:447
virtual void resizeElements(unsigned int numIndices)=0
void setNumInstances(int n)
Definition: PrimitiveSet.h:226
virtual unsigned int index(unsigned int pos) const
Definition: PrimitiveSet.h:511
virtual void computeRange() const
Definition: PrimitiveSet.h:243
DrawElementsUInt(GLenum mode=0)
Definition: PrimitiveSet.h:532
virtual const char * className() const
Definition: PrimitiveSet.h:212
virtual bool isSameKindAs(const Object *obj) const
Definition: PrimitiveSet.h:343
MixinVector< GLuint > VectorGLuint
Definition: PrimitiveSet.h:37
virtual const char * libraryName() const
Definition: PrimitiveSet.h:344
virtual void vertex(const Vec2 &vert)=0
Mimics the OpenGL glVertex() "family of functions".
DrawElements(const DrawElements &copy, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PrimitiveSet.h:376
virtual void drawArrays(GLenum mode, GLint first, GLsizei count)=0
Mimics the OpenGL glDrawArrays() function.
virtual bool isSameKindAs(const Object *obj) const
Definition: PrimitiveSet.h:497
virtual unsigned int index(unsigned int pos) const
Definition: PrimitiveSet.h:299
virtual void addElement(unsigned int v)
Definition: PrimitiveSet.h:455
#define GL_UNSIGNED_INT
Definition: GL.h:167
virtual void addElement(unsigned int v)
Definition: PrimitiveSet.h:583
DrawElementsUByte(const DrawElementsUByte &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PrimitiveSet.h:413
const osg::ElementBufferObject * getElementBufferObject() const
Definition: PrimitiveSet.h:390
DrawArrays(GLenum mode=0)
Definition: PrimitiveSet.h:258
virtual unsigned int getElement(unsigned int i)
Definition: PrimitiveSet.h:454
virtual void begin(GLenum mode)=0
MixinVector< GLushort > VectorGLushort
Definition: PrimitiveSet.h:36
virtual void reserveElements(unsigned int numIndices)
Definition: PrimitiveSet.h:452
virtual GLenum getDataType()=0
GLint getFirst() const
Definition: PrimitiveSet.h:288
virtual unsigned int getElement(unsigned int)=0
virtual const osg::PrimitiveSet * asPrimitiveSet() const
Definition: PrimitiveSet.h:217
virtual const char * className() const
Definition: PrimitiveSet.h:345
void setMode(GLenum mode)
Definition: PrimitiveSet.h:229
virtual DrawElements * getDrawElements()
Definition: PrimitiveSet.h:223
DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0)
Definition: PrimitiveSet.h:373
virtual bool isSameKindAs(const Object *obj) const
Definition: PrimitiveSet.h:561
virtual Object * cloneType() const
Definition: PrimitiveSet.h:559
virtual unsigned int getTotalDataSize() const
Definition: PrimitiveSet.h:438
virtual const char * libraryName() const
Definition: PrimitiveSet.h:276
virtual ~PrimitiveFunctor()
Definition: PrimitiveSet.h:55
virtual GLenum getDataType()
Definition: PrimitiveSet.h:514
VectorGLubyte vector_type
Definition: PrimitiveSet.h:408
void useVertexCacheAsVertexArray()
Definition: PrimitiveSet.h:123
virtual void setVertexArray(unsigned int count, const Vec2 *vertices)=0
virtual ~DrawArrayLengths()
Definition: PrimitiveSet.h:364
virtual bool supportsBufferObject() const
Definition: PrimitiveSet.h:567
virtual void resizeElements(unsigned int numIndices)
Definition: PrimitiveSet.h:451
virtual const char * libraryName() const
Definition: PrimitiveSet.h:498
virtual unsigned int index(unsigned int pos) const
Definition: PrimitiveSet.h:357
virtual const char * libraryName() const
Definition: PrimitiveSet.h:211
DrawElementsUByte(GLenum mode, unsigned int no)
Definition: PrimitiveSet.h:427
#define GL_LINE_STRIP_ADJACENCY
Definition: GLDefines.h:207
virtual ~PrimitiveSet()
Definition: PrimitiveSet.h:247
DrawElementsUShort(GLenum mode=0)
Definition: PrimitiveSet.h:469
PrimitiveSet(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0)
Definition: PrimitiveSet.h:199
void setFirst(GLint first)
Definition: PrimitiveSet.h:287
virtual unsigned int getNumIndices() const
Definition: PrimitiveSet.h:574
virtual void setElement(unsigned int i, unsigned int v)
Definition: PrimitiveSet.h:453
virtual const char * className() const
Definition: PrimitiveSet.h:499
virtual void offsetIndices(int offset)
Definition: PrimitiveSet.h:358
virtual const GLvoid * getDataPointer() const
Definition: PrimitiveSet.h:501
virtual const char * libraryName() const
Definition: PrimitiveSet.h:562
GLenum getMode() const
Definition: PrimitiveSet.h:230
DrawElementsUShort(GLenum mode, unsigned int no, const GLushort *ptr, int numInstances=0)
Definition: PrimitiveSet.h:479
DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0)
Definition: PrimitiveSet.h:263
virtual unsigned int index(unsigned int pos) const
Definition: PrimitiveSet.h:575
DrawElementsUByte(GLenum mode=0)
Definition: PrimitiveSet.h:410
virtual osg::PrimitiveSet * asPrimitiveSet()
Definition: PrimitiveSet.h:216
virtual const GLvoid * getDataPointer() const
Definition: PrimitiveSet.h:565
DrawElementsUShort(GLenum mode, unsigned int no)
Definition: PrimitiveSet.h:486
virtual void offsetIndices(int offset)
Definition: PrimitiveSet.h:300
virtual bool supportsBufferObject() const
Definition: PrimitiveSet.h:221
MixinVector< GLsizei > VectorGLsizei
Definition: PrimitiveSet.h:34
void setCount(GLsizei count)
Definition: PrimitiveSet.h:290
virtual const char * libraryName() const
Definition: PrimitiveSet.h:434
void set(GLenum mode, GLint first, GLsizei count)
Definition: PrimitiveSet.h:280
virtual void begin(GLenum mode)=0
Mimics the OpenGL glBegin() function.
virtual const char * className() const
Definition: PrimitiveSet.h:435
DrawArrayLengths(GLenum mode=0)
Definition: PrimitiveSet.h:316
virtual const GLvoid * getDataPointer() const
Definition: PrimitiveSet.h:437
Definition: AlphaFunc.h:19
virtual void reserveElements(unsigned int numIndices)=0
MixinVector< GLubyte > VectorGLubyte
Definition: PrimitiveSet.h:35
virtual const GLvoid * getDataPointer() const
Definition: PrimitiveSet.h:219
VectorGLushort vector_type
Definition: PrimitiveSet.h:467
virtual bool supportsBufferObject() const
Definition: PrimitiveSet.h:439
GLsizei getCount() const
Definition: PrimitiveSet.h:291
GLint getFirst() const
Definition: PrimitiveSet.h:349
virtual Object * cloneType() const
Definition: PrimitiveSet.h:495
virtual const DrawElements * getDrawElements() const
Definition: PrimitiveSet.h:224
DrawElementsUShort(const DrawElementsUShort &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PrimitiveSet.h:472
virtual unsigned int getElement(unsigned int i)
Definition: PrimitiveSet.h:582
virtual Object * clone(const CopyOp &copyop) const
Definition: PrimitiveSet.h:496
#define GL_TRIANGLES_ADJACENCY
Definition: GLDefines.h:208
virtual unsigned int getNumIndices() const
Definition: PrimitiveSet.h:510
virtual Object * clone(const CopyOp &copyop) const
Definition: PrimitiveSet.h:560
DrawArrayLengths(GLenum mode, GLint first)
Definition: PrimitiveSet.h:335
virtual GLenum getDataType()
Definition: PrimitiveSet.h:578
DrawElementsUInt(GLenum mode, InputIterator first, InputIterator last)
Definition: PrimitiveSet.h:555
virtual DrawElements * getDrawElements()
Definition: PrimitiveSet.h:380
virtual void setElement(unsigned int i, unsigned int v)
Definition: PrimitiveSet.h:517
virtual Object * clone(const CopyOp &copyop) const
Definition: PrimitiveSet.h:342
void setFirst(GLint first)
Definition: PrimitiveSet.h:348
osg::ref_ptr< BufferObject > _bufferObject
Definition: BufferObject.h:596
DrawElementsUInt(const DrawElementsUInt &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PrimitiveSet.h:535
virtual Object * clone(const CopyOp &copyop) const
Definition: PrimitiveSet.h:274
DrawArrays(const DrawArrays &da, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PrimitiveSet.h:268
#define GL_LINES_ADJACENCY
Definition: GLDefines.h:206
virtual ~DrawArrays()
Definition: PrimitiveSet.h:304
DrawElementsUShort(GLenum mode, InputIterator first, InputIterator last)
Definition: PrimitiveSet.h:491
virtual Object * clone(const CopyOp &copyop) const
Definition: PrimitiveSet.h:432
virtual bool supportsBufferObject() const
Definition: PrimitiveSet.h:503
virtual void addElement(unsigned int v)
Definition: PrimitiveSet.h:519
PrimitiveSet(const PrimitiveSet &prim, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PrimitiveSet.h:204
virtual void resizeElements(unsigned int numIndices)
Definition: PrimitiveSet.h:579
VectorGLsizei vector_type
Definition: PrimitiveSet.h:314
virtual unsigned int getTotalDataSize() const
Definition: PrimitiveSet.h:502
virtual unsigned int getTotalDataSize() const
Definition: PrimitiveSet.h:566
DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte *ptr, int numInstances=0)
Definition: PrimitiveSet.h:420
virtual void setVertexArray(unsigned int count, const Vec2 *vertices)=0
int getNumInstances() const
Definition: PrimitiveSet.h:227
DrawElementsUInt(GLenum mode, unsigned int no, const GLuint *ptr, int numInstances=0)
Definition: PrimitiveSet.h:543
virtual bool isSameKindAs(const Object *obj) const
Definition: PrimitiveSet.h:210
virtual void resizeElements(unsigned int numIndices)
Definition: PrimitiveSet.h:515
virtual unsigned int getNumIndices() const
Definition: PrimitiveSet.h:298
virtual unsigned int getTotalDataSize() const
Definition: PrimitiveSet.h:220
osg::ElementBufferObject * getElementBufferObject()
Definition: PrimitiveSet.h:387