H3D API  2.4.1
GLVertexAttributeObject.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
26 //
28 #ifndef __GLVERTEXATTRIBUTE_H__
29 #define __GLVERTEXATTRIBUTE_H__
30 
31 #include <H3D/H3DApi.h>
32 #include <H3D/Node.h>
33 #include <H3D/SFBool.h>
34 #include <GL/glew.h>
35 
36 namespace H3D {
37  namespace VERTEXATTRIBUTE{
38  enum VERTEXATTRIBUTETYPE{
39  VERTEX,
40  NORMAL,
41  TEXCOORD,
42  FOGCOORD,
43  COLOR,
44  GENERIC
45  };
46  }
47 
54  class H3DAPI_API GLVertexAttributeObject{
55 
56  public:
58  GLVertexAttributeObject ( VERTEXATTRIBUTE::VERTEXATTRIBUTETYPE type );
59 
61  virtual ~GLVertexAttributeObject();
62 
65  virtual void setAttributeData ( ) = 0;
66 
69  virtual void renderVBO ( ) = 0;
70 
73  virtual void disableVBO ( ) = 0;
74 
76  virtual bool preRenderCheckFail( );
77 
80  void renderVertexBufferObject ( );
81 
83  void disableVertexBufferObject ( );
84 
86  virtual void updateVertexBufferObject ( );
87 
91  H3DUniquePtr<SFBool> isDynamic;
92 
93 
94  protected:
97  H3DUniquePtr< Field > vboFieldsUpToDate;
98  // The index for the vertex buffer object
99  GLuint *vbo_id;
100 
101  GLsizei attrib_size;
102 
103  GLvoid* attrib_data;
104 
105  // the type of vertex attribute
106  VERTEXATTRIBUTE::VERTEXATTRIBUTETYPE attrib_type;
107 
108  // address of the vertex buffer object, will be used for bindless
109  // vertex attribute
110  GLuint64 vbo_GPUaddr;
111 
112  bool use_bindless, bindless_supported_by_system;
113 
114  };
115 }
116 
117 #endif
Base header file that handles all configuration related settings.
Node base class.
Contains the SFBool field class.
This abstract interface is inherited by all nodes that could be used as vertex attributes in a glsl s...
Definition: GLVertexAttributeObject.h:54
H3DUniquePtr< SFBool > isDynamic
Option to indicate whether this vertex attribute is dynamic or not Access type: inputOutput Default ...
Definition: GLVertexAttributeObject.h:91
virtual void disableVBO()=0
pure virtual function has to be implemented by inherited class to specify the actual render disable f...
virtual void setAttributeData()=0
pure virtual function has to be implemented by inherited class to specify necessay data and format fo...
H3DUniquePtr< Field > vboFieldsUpToDate
Internal field used to know if vertex buffer object can be created.
Definition: GLVertexAttributeObject.h:97
virtual void renderVBO()=0
pure virtual function has to be implemented by inherited class to specify the actual render function
H3D API namespace.
Definition: Anchor.h:38