diff --git a/src/AIS/AIS_ColorScale.cxx b/src/AIS/AIS_ColorScale.cxx index 08ec0bcf75..3493c39c3c 100644 --- a/src/AIS/AIS_ColorScale.cxx +++ b/src/AIS/AIS_ColorScale.cxx @@ -48,7 +48,7 @@ namespace theTris->AddVertex (gp_Pnt (theXLeft, theYBottom + theSizeY, 0.0), theColorTop); theTris->AddVertex (gp_Pnt (theXLeft + theSizeX, theYBottom + theSizeY, 0.0), theColorTop); theTris->AddEdges (aVertIndex, aVertIndex + 1, aVertIndex + 2); - theTris->AddEdges (aVertIndex + 1, aVertIndex + 2, aVertIndex + 3); + theTris->AddEdges (aVertIndex + 1, aVertIndex + 3, aVertIndex + 2); } //! Compute hue angle from specified value. diff --git a/src/Graphic3d/Graphic3d_ArrayFlags.hxx b/src/Graphic3d/Graphic3d_ArrayFlags.hxx index cb2da070ae..34741312ce 100644 --- a/src/Graphic3d/Graphic3d_ArrayFlags.hxx +++ b/src/Graphic3d/Graphic3d_ArrayFlags.hxx @@ -20,11 +20,12 @@ typedef Standard_Integer Graphic3d_ArrayFlags; //! Graphic3d_ArrayFlags bitmask values. enum { - Graphic3d_ArrayFlags_None = 0x00, //!< no flags - Graphic3d_ArrayFlags_VertexNormal = 0x01, //!< per-vertex normal attribute - Graphic3d_ArrayFlags_VertexColor = 0x02, //!< per-vertex color attribute - Graphic3d_ArrayFlags_VertexTexel = 0x04, //!< per-vertex texel coordinates (UV) attribute - Graphic3d_ArrayFlags_BoundColor = 0x10, + Graphic3d_ArrayFlags_None = 0x00, //!< no flags + Graphic3d_ArrayFlags_VertexNormal = 0x01, //!< per-vertex normal attribute + Graphic3d_ArrayFlags_VertexColor = 0x02, //!< per-vertex color attribute + Graphic3d_ArrayFlags_VertexColorBack = 0x04, //!< per-vertex color back attribute + Graphic3d_ArrayFlags_VertexTexel = 0x08, //!< per-vertex texel coordinates (UV) attribute + Graphic3d_ArrayFlags_BoundColor = 0x10, // advanced Graphic3d_ArrayFlags_AttribsMutable = 0x20, //!< mutable array, which can be invalidated during lifetime without re-creation Graphic3d_ArrayFlags_AttribsDeinterleaved = 0x40, //!< non-interleaved vertex attributes packed into single array diff --git a/src/Graphic3d/Graphic3d_ArrayOfPoints.hxx b/src/Graphic3d/Graphic3d_ArrayOfPoints.hxx index d43905ce41..116c3d9bd8 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfPoints.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPoints.hxx @@ -38,10 +38,12 @@ public: //! @param theHasVNormals when TRUE, AddVertex(Point,Normal) should be used for specifying vertex normal Graphic3d_ArrayOfPoints (Standard_Integer theMaxVertexs, Standard_Boolean theHasVColors = Standard_False, - Standard_Boolean theHasVNormals = Standard_False) + Standard_Boolean theHasVNormals = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POINTS, theMaxVertexs, 0, 0, (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) - | (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None)) {} + | (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/Graphic3d/Graphic3d_ArrayOfPolygons.hxx b/src/Graphic3d/Graphic3d_ArrayOfPolygons.hxx index 58c2adb645..9fc2af6685 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfPolygons.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPolygons.hxx @@ -106,12 +106,14 @@ public: const Standard_Boolean theHasVNormals = Standard_False, const Standard_Boolean theHasVColors = Standard_False, const Standard_Boolean theHasBColors = Standard_False, - const Standard_Boolean theHasVTexels = Standard_False) + const Standard_Boolean theHasVTexels = Standard_False, + const Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYGONS, theMaxVertexs, theMaxBounds, theMaxEdges, (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None) | (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None) - | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None)) {} + | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/Graphic3d/Graphic3d_ArrayOfPolylines.hxx b/src/Graphic3d/Graphic3d_ArrayOfPolylines.hxx index 786ff9ecc1..fb0737b4ba 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfPolylines.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPolylines.hxx @@ -104,10 +104,12 @@ public: Standard_Integer theMaxBounds = 0, Standard_Integer theMaxEdges = 0, Standard_Boolean theHasVColors = Standard_False, - Standard_Boolean theHasBColors = Standard_False) + Standard_Boolean theHasBColors = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYLINES, theMaxVertexs, theMaxBounds, theMaxEdges, (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) - | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None)) {} + | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx index 0e546e1bff..9246411e33 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx @@ -172,7 +172,9 @@ void Graphic3d_ArrayOfPrimitives::init (Graphic3d_TypeOfPrimitiveArray theType, anAttribs[aNbAttribs].Id = Graphic3d_TOA_COLOR; anAttribs[aNbAttribs].DataType = Graphic3d_TOD_VEC4UB; ++aNbAttribs; - + } + if ((theArrayOptions & Graphic3d_ArrayFlags_VertexColorBack) != 0) + { anAttribs[aNbAttribs].Id = Graphic3d_TOA_COLOR_BACK; anAttribs[aNbAttribs].DataType = Graphic3d_TOD_VEC4UB; ++aNbAttribs; diff --git a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx index d402d5ca99..3d2363c7b8 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx @@ -806,7 +806,15 @@ protected: //! @name protected constructors Standard_Integer theMaxBounds, Standard_Integer theMaxEdges, Graphic3d_ArrayFlags theArrayFlags) - : myNormData (NULL), myTexData (NULL), myColData (NULL), myColDataBack (NULL), myPosStride (0), myNormStride (0), myTexStride (0), myColStride (0), + : myNormData (NULL), + myTexData (NULL), + myColData (NULL), + myColDataBack (NULL), + myPosStride (0), + myNormStride (0), + myTexStride (0), + myColStride (0), + myColStrideBack (0), myType (Graphic3d_TOPA_UNDEFINED) { init (theType, theMaxVertexs, theMaxBounds, theMaxEdges, theArrayFlags); diff --git a/src/Graphic3d/Graphic3d_ArrayOfQuadrangleStrips.hxx b/src/Graphic3d/Graphic3d_ArrayOfQuadrangleStrips.hxx index 039a7c6a98..24c7638993 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfQuadrangleStrips.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfQuadrangleStrips.hxx @@ -62,12 +62,14 @@ public: Standard_Boolean theHasVNormals = Standard_False, Standard_Boolean theHasVColors = Standard_False, Standard_Boolean theHasSColors = Standard_False, - Standard_Boolean theHasVTexels = Standard_False) + Standard_Boolean theHasVTexels = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_QUADRANGLESTRIPS, theMaxVertexs, theMaxStrips, 0, (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None) | (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None) - | (theHasSColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None)) {} + | (theHasSColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} diff --git a/src/Graphic3d/Graphic3d_ArrayOfQuadrangles.hxx b/src/Graphic3d/Graphic3d_ArrayOfQuadrangles.hxx index e99be7239f..a26ff11eda 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfQuadrangles.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfQuadrangles.hxx @@ -57,11 +57,13 @@ public: Standard_Integer theMaxEdges = 0, Standard_Boolean theHasVNormals = Standard_False, Standard_Boolean theHasVColors = Standard_False, - Standard_Boolean theHasVTexels = Standard_False) + Standard_Boolean theHasVTexels = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_QUADRANGLES, theMaxVertexs, 0, theMaxEdges, (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None) | (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) - | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None)) {} + | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/Graphic3d/Graphic3d_ArrayOfSegments.hxx b/src/Graphic3d/Graphic3d_ArrayOfSegments.hxx index 2059c9587a..3b6024762d 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfSegments.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfSegments.hxx @@ -56,8 +56,10 @@ public: //! @param theHasVColors when TRUE, AddVertex(Point,Color) should be used for specifying vertex color Graphic3d_ArrayOfSegments (Standard_Integer theMaxVertexs, Standard_Integer theMaxEdges = 0, - Standard_Boolean theHasVColors = Standard_False) - : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_SEGMENTS, theMaxVertexs, 0, theMaxEdges, theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) {} + Standard_Boolean theHasVColors = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) + : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_SEGMENTS, theMaxVertexs, 0, theMaxEdges, (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/Graphic3d/Graphic3d_ArrayOfTriangleFans.hxx b/src/Graphic3d/Graphic3d_ArrayOfTriangleFans.hxx index bbd2f8ed3a..09c40602ff 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfTriangleFans.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfTriangleFans.hxx @@ -60,12 +60,14 @@ public: Standard_Boolean theHasVNormals = Standard_False, Standard_Boolean theHasVColors = Standard_False, Standard_Boolean theHasBColors = Standard_False, - Standard_Boolean theHasVTexels = Standard_False) + Standard_Boolean theHasVTexels = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_TRIANGLEFANS, theMaxVertexs, theMaxFans, 0, (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None) | (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None) - | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None)) {} + | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/Graphic3d/Graphic3d_ArrayOfTriangleStrips.hxx b/src/Graphic3d/Graphic3d_ArrayOfTriangleStrips.hxx index 5b399671ad..a7d9298547 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfTriangleStrips.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfTriangleStrips.hxx @@ -66,12 +66,14 @@ public: Standard_Boolean theHasVNormals = Standard_False, Standard_Boolean theHasVColors = Standard_False, Standard_Boolean theHasBColors = Standard_False, - Standard_Boolean theHasVTexels = Standard_False) + Standard_Boolean theHasVTexels = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_TRIANGLESTRIPS, theMaxVertexs, theMaxStrips, 0, (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None) | (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None) - | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None)) {} + | (theHasBColors ? Graphic3d_ArrayFlags_BoundColor : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/Graphic3d/Graphic3d_ArrayOfTriangles.hxx b/src/Graphic3d/Graphic3d_ArrayOfTriangles.hxx index 526e497849..70422a8ff7 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfTriangles.hxx +++ b/src/Graphic3d/Graphic3d_ArrayOfTriangles.hxx @@ -59,11 +59,13 @@ public: Standard_Integer theMaxEdges = 0, Standard_Boolean theHasVNormals = Standard_False, Standard_Boolean theHasVColors = Standard_False, - Standard_Boolean theHasVTexels = Standard_False) + Standard_Boolean theHasVTexels = Standard_False, + Standard_Boolean theHasVColorsBack = Standard_False) : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_TRIANGLES, theMaxVertexs, 0, theMaxEdges, (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None) | (theHasVColors ? Graphic3d_ArrayFlags_VertexColor : Graphic3d_ArrayFlags_None) - | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None)) {} + | (theHasVTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None) + | (theHasVColorsBack ? Graphic3d_ArrayFlags_VertexColorBack : Graphic3d_ArrayFlags_None)) {} }; diff --git a/src/OpenGl/OpenGl_FrameStatsPrs.cxx b/src/OpenGl/OpenGl_FrameStatsPrs.cxx index 93f111c786..fe922530bd 100644 --- a/src/OpenGl/OpenGl_FrameStatsPrs.cxx +++ b/src/OpenGl/OpenGl_FrameStatsPrs.cxx @@ -427,7 +427,7 @@ void OpenGl_FrameStatsPrs::Render (const Handle(OpenGl_Workspace)& theWorkspace) myChartVertices->Bind (aCtx); myChartVertices->bindAttribute (aCtx, Graphic3d_TOA_POS, 3, GL_FLOAT, myChartVertices->GetComponentsNb(), NULL); myChartVertices->bindAttribute (aCtx, Graphic3d_TOA_COLOR, 4, GL_UNSIGNED_BYTE, myChartVertices->GetComponentsNb(), (void* )sizeof(Graphic3d_Vec3)); - myChartVertices->bindAttribute (aCtx, Graphic3d_TOA_COLOR_BACK, 5, GL_UNSIGNED_BYTE, myChartVertices->GetComponentsNb(), (void*)sizeof(Graphic3d_Vec3)); + myChartVertices->bindAttribute (aCtx, Graphic3d_TOA_COLOR_BACK, 4, GL_UNSIGNED_BYTE, myChartVertices->GetComponentsNb(), (void*)sizeof(Graphic3d_Vec3)); myChartIndices->Bind (aCtx); aCtx->core15fwd->glDrawElements (GL_TRIANGLES, myChartIndices->GetElemsNb(), myChartIndices->GetDataType(), NULL); @@ -441,7 +441,7 @@ void OpenGl_FrameStatsPrs::Render (const Handle(OpenGl_Workspace)& theWorkspace) myChartLines->Bind (aCtx); myChartLines->bindAttribute (aCtx, Graphic3d_TOA_POS, 3, GL_FLOAT, myChartLines->GetComponentsNb(), NULL); myChartLines->bindAttribute (aCtx, Graphic3d_TOA_COLOR, 4, GL_UNSIGNED_BYTE, myChartLines->GetComponentsNb(), (void* )sizeof(Graphic3d_Vec3)); - myChartLines->bindAttribute (aCtx, Graphic3d_TOA_COLOR_BACK, 5, GL_UNSIGNED_BYTE, myChartLines->GetComponentsNb(), (void*)sizeof(Graphic3d_Vec3)); + myChartLines->bindAttribute (aCtx, Graphic3d_TOA_COLOR_BACK, 4, GL_UNSIGNED_BYTE, myChartLines->GetComponentsNb(), (void*)sizeof(Graphic3d_Vec3)); aCtx->core15fwd->glDrawArrays (GL_LINES, 0, myChartLines->GetElemsNb()); myChartLines->Unbind (aCtx); myChartLines->unbindAttribute (aCtx, Graphic3d_TOA_COLOR_BACK); diff --git a/src/OpenGl/OpenGl_VertexBuffer.cxx b/src/OpenGl/OpenGl_VertexBuffer.cxx index c46ce0d107..f2883844c6 100644 --- a/src/OpenGl/OpenGl_VertexBuffer.cxx +++ b/src/OpenGl/OpenGl_VertexBuffer.cxx @@ -205,7 +205,7 @@ void OpenGl_VertexBuffer::bindFixed (const Handle(OpenGl_Context)& theCtx, { theCtx->core11ffp->glEnableClientState (GL_COLOR_ARRAY); theCtx->core11ffp->glColorPointer (theNbComp, theDataType, theStride, theOffset); - theCtx->core11ffp->glColorMaterial (GL_FRONT,GL_AMBIENT_AND_DIFFUSE); + theCtx->core11ffp->glColorMaterial (GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); theCtx->core11fwd->glEnable (GL_COLOR_MATERIAL); return; } @@ -236,8 +236,8 @@ void OpenGl_VertexBuffer::unbindFixed (const Handle(OpenGl_Context)& theCtx, case Graphic3d_TOA_POS: theCtx->core11ffp->glDisableClientState (GL_VERTEX_ARRAY); return; case Graphic3d_TOA_NORM: theCtx->core11ffp->glDisableClientState (GL_NORMAL_ARRAY); return; case Graphic3d_TOA_UV: theCtx->core11ffp->glDisableClientState (GL_TEXTURE_COORD_ARRAY); return; - case Graphic3d_TOA_COLOR: unbindFixedColor (theCtx); return; - case Graphic3d_TOA_COLOR_BACK: + case Graphic3d_TOA_COLOR: unbindFixedColor (theCtx); return; + case Graphic3d_TOA_COLOR_BACK: unbindFixedColor (theCtx); return; case Graphic3d_TOA_CUSTOM: { return;