Open Inventor Reference
SoGLVBOElement.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_GL_VBO_ELEMENT_
39 #define _SO_GL_VBO_ELEMENT_
40 
43 #include <Inventor/misc/SoVBO.h>
44 #include <Inventor/SoMachine.h>
45 
49 {
50  typedef SoElement inherited;
51 
53 
54 public:
55  enum VBOType {
56  VERTEX_VBO = 0,
57  NORMAL_VBO = 1,
58  COLOR_VBO = 2,
59  TEXCOORD_VBO = 3,
60  MAX_VBO_TYPES = 4
61  };
62 
63  virtual void init(SoState *state);
64  virtual void push(SoState *state);
65  virtual void pop(SoState *state, const SoElement *childElt);
66 
68  static const SoGLVBOElement* getInstance(SoState* state);
69 
71  static void unsetVBO(SoState* state, VBOType type);
73  static void unsetVBOIfEnabled(SoState* state, VBOType type);
74 
77  static void updateVBO(SoState* state, VBOType type, SoVBO** vbo, int numBytes = 0, const void* data = NULL, SbNodeIdType nodeId = 0);
78 
80  SoVBO* getVBO(VBOType type) const;
81 
82  bool matches(const SoElement *elt) const;
84 
85 protected:
86 
88  virtual ~SoGLVBOElement();
89 
90 SoINTERNAL public:
91 
93  static void initClass();
94 
95 private:
96  SoVBO* _vbo[MAX_VBO_TYPES];
97 
98 };
99 
100 #endif // _SO_GL_VBO_ELEMENT_
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition: SbBasic.h:154
#define SoINTERNAL
Definition: SbBasic.h:155
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
#define SO_ELEMENT_HEADER(className)
This one is for non-abstract element classes.
Definition: SoSubElement.h:112
This is the abstract base class for all state elements.
Definition: SoElement.h:96
Manage the currently registered VBOs in the state (for coordinates, normals, colors and tex coords) (...
static void unsetVBOIfEnabled(SoState *state, VBOType type)
remove the given VBO from element if the element is enabled in state.
static void initClass()
Initializes the SoGLVBOElement class.
static void unsetVBO(SoState *state, VBOType type)
remove the given VBO from element
virtual void pop(SoState *state, const SoElement *childElt)
SoElement * copyMatchInfo() const
Create a copy that we can put in a cache used list and call matches() on later.
virtual void push(SoState *state)
Pushes/pops element.
bool matches(const SoElement *elt) const
Returns TRUE if the element matches another element (of the same class, presumably) with respect to c...
virtual void init(SoState *state)
Initializes element.
static void updateVBO(SoState *state, VBOType type, SoVBO **vbo, int numBytes=0, const void *data=NULL, SbNodeIdType nodeId=0)
creates or clear a VBO of given type.
SoVBO * getVBO(VBOType type) const
get a vbo
virtual ~SoGLVBOElement()
Destructor.
static const SoGLVBOElement * getInstance(SoState *state)
get const instance
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