From: kgv Date: Fri, 23 Dec 2016 18:21:00 +0000 (+0300) Subject: 0028276: Visualization, Graphic3d_ArrayOfPrimitives - fix usage of 16-bit indices X-Git-Tag: V_01_2017_06_30~68 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=09f30297f40a58f2aaa7a91a930088662becadbb 0028276: Visualization, Graphic3d_ArrayOfPrimitives - fix usage of 16-bit indices Graphic3d_ArrayOfPrimitives now check the amount of vertex data rather than amount of indices. --- diff --git a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx index 6fe98f0f3e..037c05f85b 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx @@ -56,7 +56,7 @@ Graphic3d_ArrayOfPrimitives::Graphic3d_ArrayOfPrimitives (const Graphic3d_TypeOf if (theMaxEdges > 0) { myIndices = new Graphic3d_IndexBuffer (anAlloc); - if (theMaxEdges < Standard_Integer(USHRT_MAX)) + if (theMaxVertexs < Standard_Integer(USHRT_MAX)) { if (!myIndices->Init (theMaxEdges)) { diff --git a/src/OpenGl/OpenGl_PrimitiveArray.cxx b/src/OpenGl/OpenGl_PrimitiveArray.cxx index 47c789c6af..811097de6c 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.cxx @@ -943,12 +943,13 @@ void OpenGl_PrimitiveArray::setDrawMode (const Graphic3d_TypeOfPrimitiveArray th Standard_Boolean OpenGl_PrimitiveArray::processIndices (const Handle(OpenGl_Context)& theContext) const { if (myIndices.IsNull() + || myAttribs.IsNull() || theContext->hasUintIndex) { return Standard_True; } - if (myIndices->NbElements > std::numeric_limits::max()) + if (myAttribs->NbElements > std::numeric_limits::max()) { Handle(Graphic3d_Buffer) anAttribs = new Graphic3d_Buffer (new NCollection_AlignedAllocator (16)); if (!anAttribs->Init (myIndices->NbElements, myAttribs->AttributesArray(), myAttribs->NbAttributes))