mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-06 18:26:22 +03:00
0024113: Provide missing OpenGl_VertexBuffer::SubData() specializations
remark on doxygen documentation
This commit is contained in:
parent
29cb310ae9
commit
99d99a6db2
@ -179,6 +179,31 @@ bool OpenGl_VertexBuffer::Init (const Handle(OpenGl_Context)& theGlCtx,
|
|||||||
return isDone;
|
return isDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SubData
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
bool OpenGl_VertexBuffer::SubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||||
|
const GLsizei theElemFrom,
|
||||||
|
const GLsizei theElemsNb,
|
||||||
|
const GLuint* theData)
|
||||||
|
{
|
||||||
|
if (!IsValid() || myDataType != GL_UNSIGNED_INT
|
||||||
|
|| theElemFrom < 0 || ((theElemFrom + theElemsNb) > myElemsNb))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bind (theGlCtx);
|
||||||
|
theGlCtx->core15->glBufferSubData (GetTarget(),
|
||||||
|
GLintptr(theElemFrom) * GLintptr(myComponentsNb) * sizeof(GLuint), // offset in bytes
|
||||||
|
GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * sizeof(GLuint), // size in bytes
|
||||||
|
theData);
|
||||||
|
bool isDone = (glGetError() == GL_NO_ERROR); // GL_OUT_OF_MEMORY
|
||||||
|
Unbind (theGlCtx);
|
||||||
|
return isDone;
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : Init
|
// function : Init
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -203,6 +228,31 @@ bool OpenGl_VertexBuffer::Init (const Handle(OpenGl_Context)& theGlCtx,
|
|||||||
return isDone;
|
return isDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SubData
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
bool OpenGl_VertexBuffer::SubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||||
|
const GLsizei theElemFrom,
|
||||||
|
const GLsizei theElemsNb,
|
||||||
|
const GLubyte* theData)
|
||||||
|
{
|
||||||
|
if (!IsValid() || myDataType != GL_UNSIGNED_BYTE
|
||||||
|
|| theElemFrom < 0 || ((theElemFrom + theElemsNb) > myElemsNb))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bind (theGlCtx);
|
||||||
|
theGlCtx->core15->glBufferSubData (GetTarget(),
|
||||||
|
GLintptr(theElemFrom) * GLintptr(myComponentsNb) * sizeof(GLubyte), // offset in bytes
|
||||||
|
GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * sizeof(GLubyte), // size in bytes
|
||||||
|
theData);
|
||||||
|
bool isDone = (glGetError() == GL_NO_ERROR); // GL_OUT_OF_MEMORY
|
||||||
|
Unbind (theGlCtx);
|
||||||
|
return isDone;
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : BindVertexAttrib
|
// function : BindVertexAttrib
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -113,13 +113,35 @@ public:
|
|||||||
//! Function replaces portion of data within this VBO using glBufferSubData().
|
//! Function replaces portion of data within this VBO using glBufferSubData().
|
||||||
//! The VBO should be initialized before call.
|
//! The VBO should be initialized before call.
|
||||||
//! @param theElemFrom - element id from which replace buffer data (>=0);
|
//! @param theElemFrom - element id from which replace buffer data (>=0);
|
||||||
//! @param theElemsNb - elements count (theElemFrom + theElemsNb < GetElemsNb());
|
//! @param theElemsNb - elements count (theElemFrom + theElemsNb <= GetElemsNb());
|
||||||
//! @param theData - pointer to GLfloat data.
|
//! @param theData - pointer to GLfloat data.
|
||||||
Standard_EXPORT bool SubData (const Handle(OpenGl_Context)& theGlCtx,
|
Standard_EXPORT bool SubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||||
const GLsizei theElemFrom,
|
const GLsizei theElemFrom,
|
||||||
const GLsizei theElemsNb,
|
const GLsizei theElemsNb,
|
||||||
const GLfloat* theData);
|
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.
|
||||||
|
//! @param theElemFrom element id from which replace buffer data (>=0);
|
||||||
|
//! @param theElemsNb elements count (theElemFrom + theElemsNb <= GetElemsNb());
|
||||||
|
//! @param theData pointer to GLuint data.
|
||||||
|
Standard_EXPORT bool SubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||||
|
const GLsizei theElemFrom,
|
||||||
|
const GLsizei theElemsNb,
|
||||||
|
const GLuint* 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.
|
||||||
|
//! @param theElemFrom element id from which replace buffer data (>=0);
|
||||||
|
//! @param theElemsNb elements count (theElemFrom + theElemsNb <= GetElemsNb());
|
||||||
|
//! @param theData pointer to GLubyte data.
|
||||||
|
Standard_EXPORT bool SubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||||
|
const GLsizei theElemFrom,
|
||||||
|
const GLsizei theElemsNb,
|
||||||
|
const GLubyte* theData);
|
||||||
|
|
||||||
//! Bind this VBO to active GLSL program.
|
//! Bind this VBO to active GLSL program.
|
||||||
Standard_EXPORT void BindVertexAttrib (const Handle(OpenGl_Context)& theGlCtx,
|
Standard_EXPORT void BindVertexAttrib (const Handle(OpenGl_Context)& theGlCtx,
|
||||||
const GLuint theAttribLoc) const;
|
const GLuint theAttribLoc) const;
|
||||||
|
@ -111,6 +111,12 @@ public:
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! @return assigned VBO
|
||||||
|
inline const Handle(OpenGl_VertexBuffer)& GetVBO() const
|
||||||
|
{
|
||||||
|
return myVbo;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Handle(OpenGl_Context) myGlCtx; //!< handle to current OpenGL context
|
Handle(OpenGl_Context) myGlCtx; //!< handle to current OpenGL context
|
||||||
|
Loading…
x
Reference in New Issue
Block a user