Open CASCADE Technology 6.6.0
|
Vertex Buffer Object - is a general storage object for vertex attributes (position, normal, color). Notice that you should use OpenGl_IndexBuffer specialization for array of indices.
#include <OpenGl_VertexBuffer.hxx>
Public Member Functions | |
OpenGl_VertexBuffer () | |
Create uninitialized VBO. | |
virtual | ~OpenGl_VertexBuffer () |
Destroy object. | |
virtual GLenum | GetTarget () const |
bool | IsValid () const |
GLuint | GetComponentsNb () const |
GLsizei | GetElemsNb () const |
GLenum | GetDataType () const |
bool | Create (const Handle< OpenGl_Context > &theGlCtx) |
Creates VBO name (id) if not yet generated. Data should be initialized by another method. | |
virtual void | Release (const OpenGl_Context *theGlCtx) |
Destroy object - will release GPU memory if any. | |
void | Bind (const Handle< OpenGl_Context > &theGlCtx) const |
Bind this VBO. | |
void | Unbind (const Handle< OpenGl_Context > &theGlCtx) const |
Unbind this VBO. | |
bool | Init (const Handle< OpenGl_Context > &theGlCtx, const GLuint theComponentsNb, const GLsizei theElemsNb, const GLfloat *theData) |
Notice that VBO will be unbound after this call. | |
bool | Init (const Handle< OpenGl_Context > &theGlCtx, const GLuint theComponentsNb, const GLsizei theElemsNb, const GLuint *theData) |
Notice that VBO will be unbound after this call. | |
bool | Init (const Handle< OpenGl_Context > &theGlCtx, const GLuint theComponentsNb, const GLsizei theElemsNb, const GLubyte *theData) |
Notice that VBO will be unbound after this call. | |
bool | SubData (const Handle< OpenGl_Context > &theGlCtx, const GLsizei theElemFrom, const GLsizei theElemsNb, const GLfloat *theData) |
Notice that VBO will be unbound after this call. Function replaces portion of data within this VBO using glBufferSubData(). The VBO should be initialized before call. | |
void | BindVertexAttrib (const Handle< OpenGl_Context > &theGlCtx, const GLuint theAttribLoc) const |
Bind this VBO to active GLSL program. | |
void | UnbindVertexAttrib (const Handle< OpenGl_Context > &theGlCtx, const GLuint theAttribLoc) const |
Unbind any VBO from active GLSL program. | |
void | BindFixed (const Handle< OpenGl_Context > &theGlCtx, const GLenum theMode) const |
Bind this VBO as fixed pipeline attribute. | |
void | UnbindFixed (const Handle< OpenGl_Context > &theGlCtx, const GLenum theMode) const |
Unbind this VBO as fixed pipeline attribute. | |
Static Public Attributes | |
static const GLuint | NO_BUFFER = 0 |
Helpful constants. | |
Protected Attributes | |
GLuint | myBufferId |
VBO name (index) | |
GLuint | myComponentsNb |
Number of components per generic vertex attribute, must be 1, 2, 3, or 4. | |
GLsizei | myElemsNb |
Number of vertex attributes / number of vertices. | |
GLenum | myDataType |
Data type (GL_FLOAT, GL_UNSIGNED_INT, GL_UNSIGNED_BYTE etc.) |
OpenGl_VertexBuffer::OpenGl_VertexBuffer | ( | ) |
virtual OpenGl_VertexBuffer::~OpenGl_VertexBuffer | ( | ) | [virtual] |
void OpenGl_VertexBuffer::Bind | ( | const Handle< OpenGl_Context > & | theGlCtx | ) | const |
void OpenGl_VertexBuffer::BindFixed | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLenum | theMode | ||
) | const |
theGlCtx | - handle to bound GL context; |
theMode | - array mode (GL_VERTEX_ARRAY, GL_NORMAL_ARRAY, GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY). |
void OpenGl_VertexBuffer::BindVertexAttrib | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLuint | theAttribLoc | ||
) | const |
bool OpenGl_VertexBuffer::Create | ( | const Handle< OpenGl_Context > & | theGlCtx | ) |
Reimplemented in OpenGl_TextureBufferArb.
GLuint OpenGl_VertexBuffer::GetComponentsNb | ( | ) | const [inline] |
GLenum OpenGl_VertexBuffer::GetDataType | ( | ) | const [inline] |
GLsizei OpenGl_VertexBuffer::GetElemsNb | ( | ) | const [inline] |
virtual GLenum OpenGl_VertexBuffer::GetTarget | ( | ) | const [virtual] |
Reimplemented in OpenGl_IndexBuffer, and OpenGl_TextureBufferArb.
bool OpenGl_VertexBuffer::Init | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLuint | theComponentsNb, | ||
const GLsizei | theElemsNb, | ||
const GLfloat * | theData | ||
) |
theComponentsNb | - specifies the number of components per generic vertex attribute; must be 1, 2, 3, or 4; |
theElemsNb | - elements count; |
theData | - pointer to GLfloat data (vertices/normals etc.). |
Reimplemented in OpenGl_TextureBufferArb.
bool OpenGl_VertexBuffer::Init | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLuint | theComponentsNb, | ||
const GLsizei | theElemsNb, | ||
const GLuint * | theData | ||
) |
theComponentsNb | - specifies the number of components per generic vertex attribute; must be 1, 2, 3, or 4; |
theElemsNb | - elements count; |
theData | - pointer to GLuint data (indices etc.). |
bool OpenGl_VertexBuffer::Init | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLuint | theComponentsNb, | ||
const GLsizei | theElemsNb, | ||
const GLubyte * | theData | ||
) |
theComponentsNb | - specifies the number of components per generic vertex attribute; must be 1, 2, 3, or 4; |
theElemsNb | - elements count; |
theData | - pointer to GLubyte data (indices/colors etc.). |
bool OpenGl_VertexBuffer::IsValid | ( | ) | const [inline] |
Reimplemented in OpenGl_TextureBufferArb.
virtual void OpenGl_VertexBuffer::Release | ( | const OpenGl_Context * | theGlCtx | ) | [virtual] |
Implements OpenGl_Resource.
Reimplemented in OpenGl_TextureBufferArb.
bool OpenGl_VertexBuffer::SubData | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLsizei | theElemFrom, | ||
const GLsizei | theElemsNb, | ||
const GLfloat * | theData | ||
) |
theElemFrom | - element id from which replace buffer data (>=0); |
theElemsNb | - elements count (theElemFrom + theElemsNb < GetElemsNb()); |
theData | - pointer to GLfloat data. |
void OpenGl_VertexBuffer::Unbind | ( | const Handle< OpenGl_Context > & | theGlCtx | ) | const |
void OpenGl_VertexBuffer::UnbindFixed | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLenum | theMode | ||
) | const |
theGlCtx | - handle to bound GL context; |
theMode | - array mode. |
void OpenGl_VertexBuffer::UnbindVertexAttrib | ( | const Handle< OpenGl_Context > & | theGlCtx, |
const GLuint | theAttribLoc | ||
) | const |
GLuint OpenGl_VertexBuffer::myBufferId [protected] |
GLuint OpenGl_VertexBuffer::myComponentsNb [protected] |
GLenum OpenGl_VertexBuffer::myDataType [protected] |
GLsizei OpenGl_VertexBuffer::myElemsNb [protected] |
const GLuint OpenGl_VertexBuffer::NO_BUFFER = 0 [static] |