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);
-
- /*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->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);
+ //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);
- myVboAttribs->UnbindAllAttributes(theCtx);
+ //myVboAttribs->Bind(theCtx);
+ //theCtx->core15fwd->glBufferData(myVboAttribs->GetTarget(), aSize, myAttribs->Data(), GL_STATIC_DRAW);
+ //myVboAttribs->Unbind(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;
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;
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);
}