Open Inventor Reference
SoVertexArrayIndexer.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2011 MeVis Medical Solutions AG All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * Further, this software is distributed without any warranty that it is
16  * free of the rightful claim of any third person regarding infringement
17  * or the like. Any license provided herein, whether implied or
18  * otherwise, applies only to this software file. Patent licenses, if
19  * any, provided herein do not apply to combinations of this program with
20  * other software, or any other product whatsoever.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Contact information: MeVis, Center for Medical Diagnostic Systems and
27  * Visualization GmbH, Universitätsallee 29, D-28359 Bremen, GERMANY, or:
28  *
29  * http://www.mevis.de
30  *
31  */
32 
33 /*
34  Author: Florian Link
35  Date: 09-2011
36 */
37 
38 #ifndef _SO_VERTEX_ARRAY_INDEXER_
39 #define _SO_VERTEX_ARRAY_INDEXER_
40 
41 #include <Inventor/SbBasic.h>
43 #include <Inventor/misc/SoVBO.h>
44 
45 class SoState;
46 class SoGLDisplayList;
47 
57 {
58 public:
60  SoVertexArrayIndexer(GLenum type);
62 
64  void setType(GLenum type) { _type = type; }
65 
67  GLenum getType() const { return _type; }
68 
70  void clear();
71 
73  void freeGL(SoState* state = NULL);
74 
76  void render(SoState* state, bool useVbo);
77 
79  SbNodeIdType getDataId() const { return _nodeId; }
80 
82  void setInventorTriangles(int numTriangles, const int32_t* inventorIndices, SbNodeIdType nodeId);
83 
85  void setInventorQuads(int numQuads, const int32_t* inventorIndices, SbNodeIdType nodeId);
86 
88  void setInventorLines(int numLines, const int32_t* inventorIndices, SbNodeIdType nodeId);
89 
92  void setIndices(int numIndices, const int32_t* indices, SbNodeIdType nodeId );
93 
94 private:
95  GLenum _type;
96 
97  SbNodeIdType _nodeId;
98 
99  bool _ownsIndices;
100  int _numIndices;
101  GLuint* _indices;
102 
103  SoVBO* _indexVbo;
104 };
105 
106 #endif
size_t SbNodeIdType
Type of unique ids of SoNode, used in the notification/change detection handling.
Definition: SbBasic.h:90
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition: SbSystem.h:81
signed int int32_t
Definition: SbTypeDefs.h:43
Class SoGLDisplayList:
An SoState collects and holds state while traversing a scene graph.
Definition: SoState.h:82
SoVBO is used to manage OpenGL vertex buffer objects.
Definition: SoVBO.h:52
SoVertexArrayIndexer is a class that manages rendering of indexed primitives using Vertex Array rende...
void setIndices(int numIndices, const int32_t *indices, SbNodeIdType nodeId)
set the indices, the ownership stays with the caller and the caller has to make sure that the indices...
void setInventorTriangles(int numTriangles, const int32_t *inventorIndices, SbNodeIdType nodeId)
set the triangles from inventor (3 indices separated by -1), does an internal copy without -1
SbNodeIdType getDataId() const
get the node id of the data
void setInventorLines(int numLines, const int32_t *inventorIndices, SbNodeIdType nodeId)
set the triangles from inventor (2 indices separated by -1), does an internal copy without -1
void clear()
frees the allocated data
SoVertexArrayIndexer(GLenum type)
create vertex array indexer for given GL primitives (GL_LINES, GL_TRIANGLES, GL_QUADS,...
void setInventorQuads(int numQuads, const int32_t *inventorIndices, SbNodeIdType nodeId)
set the triangles from inventor (4 indices separated by -1), does an internal copy without -1
void render(SoState *state, bool useVbo)
render the primitives (uses a VBO if useVbo is passed in)
void setType(GLenum type)
set the type
void freeGL(SoState *state=NULL)
free the GL part of the SoVertexArrayIndexer (if state is passed, the VBO may be deleted immediately)
GLenum getType() const
get the type