mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
implementation via glBufferSubData
This commit is contained in:
@@ -361,33 +361,23 @@ Standard_Boolean OpenGl_PrimitiveArray::buildVBO (const Handle(OpenGl_Context)&
|
||||
|
||||
Standard_Boolean OpenGl_PrimitiveArray::updateVBO(const Handle(OpenGl_Context)& theCtx) const
|
||||
{
|
||||
int aStride = myAttribs->IsInterleaved() ? myAttribs->Stride : myAttribs->AttributeOffset(myAttribs->NbAttributes) / myAttribs->NbElements;
|
||||
int aSize = myAttribs->AttributeOffset(myAttribs->NbAttributes);
|
||||
myVboAttribs->init(theCtx, aStride, myAttribs->NbElements, myAttribs->Data(), GL_UNSIGNED_BYTE, aStride);
|
||||
//int aStride = myAttribs->IsInterleaved() ? myAttribs->Stride : myAttribs->AttributeOffset(myAttribs->NbAttributes) / myAttribs->NbElements;
|
||||
//int aSize = myAttribs->AttributeOffset(myAttribs->NbAttributes);
|
||||
//myVboAttribs->init(theCtx, aStride, myAttribs->NbElements, myAttribs->Data(), GL_UNSIGNED_BYTE, aStride);
|
||||
|
||||
/*GLint a, b, c;
|
||||
theCtx->core15fwd->glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &a);
|
||||
theCtx->core15fwd->glGetIntegerv(GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &b);
|
||||
theCtx->core15fwd->glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &c);
|
||||
//myVboAttribs->Bind(theCtx);
|
||||
//theCtx->core15fwd->glBufferData(myVboAttribs->GetTarget(), aSize, myAttribs->Data(), GL_STATIC_DRAW);
|
||||
//myVboAttribs->Unbind(theCtx);
|
||||
|
||||
myVboAttribs->BindAllAttributes(theCtx);
|
||||
|
||||
printf("array buffer: %i\n", (int)a);
|
||||
printf("vertex attrib: %i\n", (int)b);
|
||||
printf("element array: %i\n", (int)c);
|
||||
printf("my buffer: %i\n", (int)myVboAttribs->BufferId());
|
||||
theCtx->core15fwd->glBufferData(myVboAttribs->GetTarget(), aSize, myAttribs->Data(), GL_STATIC_DRAW);
|
||||
|
||||
myVboAttribs->UnbindAllAttributes(theCtx);
|
||||
|
||||
/*const std::vector<Graphic3d_Range>& ranges = myAttribs->InvalidatedRanges();
|
||||
myVboAttribs->Bind(theCtx);
|
||||
const std::vector<Graphic3d_Range>& ranges = myAttribs->InvalidatedRanges();
|
||||
for (size_t i = 0, n = ranges.size(); i < n; i++)
|
||||
{
|
||||
Graphic3d_Range aRange = ranges[i];
|
||||
theCtx->core15fwd->glBufferSubData(myVboAttribs->GetTarget(),
|
||||
aRange.Start, aRange.Length, myAttribs->Data() + aRange.Start);
|
||||
}*/
|
||||
//myVboAttribs->Unbind(theCtx);
|
||||
}
|
||||
myVboAttribs->Unbind(theCtx);
|
||||
|
||||
myAttribs->Validate();
|
||||
return Standard_True;
|
||||
@@ -777,8 +767,8 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
||||
myIsVboInit = Standard_True;
|
||||
}
|
||||
|
||||
//if (!myAttribs.IsNull() && myAttribs->IsMutable() && myAttribs->InvalidatedRanges().size() > 0)
|
||||
// updateVBO(aCtx);
|
||||
if (!myAttribs.IsNull() && myAttribs->IsMutable() && myAttribs->InvalidatedRanges().size() > 0)
|
||||
updateVBO(aCtx);
|
||||
|
||||
// Temporarily disable environment mapping
|
||||
Handle(OpenGl_TextureSet) aTextureBack;
|
||||
@@ -901,9 +891,6 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
||||
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_HIDDENLINE
|
||||
? myBounds->Colors
|
||||
: NULL;
|
||||
if (!myAttribs.IsNull() && myAttribs->IsMutable() && myAttribs->InvalidatedRanges().size() > 0)
|
||||
updateVBO(aCtx);
|
||||
|
||||
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user