diff --git a/src/OpenGl/OpenGl_BackgroundArray.cxx b/src/OpenGl/OpenGl_BackgroundArray.cxx index ac7316b65c..ae59c9f644 100644 --- a/src/OpenGl/OpenGl_BackgroundArray.cxx +++ b/src/OpenGl/OpenGl_BackgroundArray.cxx @@ -337,7 +337,7 @@ Standard_Boolean OpenGl_BackgroundArray::createTextureArray (const Handle(OpenGl // Get texture parameters const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); - const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_False); + const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace(); GLfloat aTextureWidth = (GLfloat )anAspectFace->TextureRes (aCtx)->SizeX(); GLfloat aTextureHeight = (GLfloat )anAspectFace->TextureRes (aCtx)->SizeY(); diff --git a/src/OpenGl/OpenGl_CappingAlgo.cxx b/src/OpenGl/OpenGl_CappingAlgo.cxx index 636c31898b..13f33c484d 100755 --- a/src/OpenGl/OpenGl_CappingAlgo.cxx +++ b/src/OpenGl/OpenGl_CappingAlgo.cxx @@ -65,7 +65,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks } // remember current aspect face defined in workspace - const OpenGl_AspectFace* aFaceAsp = theWorkspace->AspectFace (Standard_False); + const OpenGl_AspectFace* aFaceAsp = theWorkspace->AspectFace(); // replace primitive groups rendering filter Handle(OpenGl_RenderFilter) aRenderFilter = theWorkspace->GetRenderFilter(); @@ -104,7 +104,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks // override aspects, disable culling theWorkspace->SetAspectFace (&theWorkspace->NoneCulling()); - theWorkspace->AspectFace (Standard_True); + theWorkspace->ApplyAspectFace(); // evaluate number of pair faces glDisable (GL_DEPTH_TEST); @@ -117,7 +117,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks // override material, cull back faces theWorkspace->SetAspectFace (&theWorkspace->FrontCulling()); - theWorkspace->AspectFace (Standard_True); + theWorkspace->ApplyAspectFace(); // enable all clip plane except the rendered one for (aPlaneIt.Init (aContextPlanes); aPlaneIt.More(); aPlaneIt.Next()) @@ -176,7 +176,7 @@ void OpenGl_CappingAlgo::RenderPlane (const Handle(OpenGl_Workspace)& theWorkspa aPlaneRes->Update (aContext); - const OpenGl_AspectFace* aFaceAspect = theWorkspace->AspectFace (Standard_False); + const OpenGl_AspectFace* aFaceAspect = theWorkspace->AspectFace(); const OpenGl_AspectFace* aPlaneAspect = aPlaneRes->AspectFace(); if (aPlaneAspect != NULL) { diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx index 10a2c51871..048b48ce87 100644 --- a/src/OpenGl/OpenGl_Context.cxx +++ b/src/OpenGl/OpenGl_Context.cxx @@ -2514,7 +2514,8 @@ Handle(OpenGl_FrameBuffer) OpenGl_Context::SetDefaultFrameBuffer (const Handle(O // function : SetShadingMaterial // purpose : // ======================================================================= -void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect) +void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect, + const OpenGl_Vec4* theHighlightColor) { if (!myActiveProgram.IsNull()) { @@ -2541,6 +2542,12 @@ void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect) : theAspect->IntBack(); aParams.Init (aProp); aParams.Diffuse.a() = aProp.trans; + + if (theHighlightColor != NULL) + { + aParams.SetColor (*theHighlightColor); + } + myActiveProgram->SetUniform (this, aLoc, OpenGl_Material::NbOfVec4(), aParams.Packed()); } diff --git a/src/OpenGl/OpenGl_Context.hxx b/src/OpenGl/OpenGl_Context.hxx index f43b38122f..da0fc548b5 100644 --- a/src/OpenGl/OpenGl_Context.hxx +++ b/src/OpenGl/OpenGl_Context.hxx @@ -551,7 +551,8 @@ public: //! @name methods to alter or retrieve current state Standard_EXPORT Standard_Boolean BindProgram (const Handle(OpenGl_ShaderProgram)& theProgram); //! Setup current shading material. - Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect); + Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect, + const OpenGl_Vec4* theHighlightColor = NULL); //! Setup current color. Standard_EXPORT void SetColor4fv (const OpenGl_Vec4& theColor); diff --git a/src/OpenGl/OpenGl_GraduatedTrihedron.cxx b/src/OpenGl/OpenGl_GraduatedTrihedron.cxx index a836256821..82ea7ba003 100755 --- a/src/OpenGl/OpenGl_GraduatedTrihedron.cxx +++ b/src/OpenGl/OpenGl_GraduatedTrihedron.cxx @@ -615,8 +615,8 @@ void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace)& theWorks Standard_ExtCharacter anAxesState = getGridAxes (aCorners, aGridAxes); // Remember current aspects - const OpenGl_AspectLine* anOldAspectLine = theWorkspace->AspectLine (Standard_False); - const OpenGl_AspectText* anOldAspectText = theWorkspace->AspectText (Standard_False); + const OpenGl_AspectLine* anOldAspectLine = theWorkspace->AspectLine(); + const OpenGl_AspectText* anOldAspectText = theWorkspace->AspectText(); OpenGl_Mat4 aModelMatrix; aModelMatrix.Convert (aContext->WorldViewState.Current()); diff --git a/src/OpenGl/OpenGl_Group.cxx b/src/OpenGl/OpenGl_Group.cxx index bd8d918ab3..cfa99571d8 100644 --- a/src/OpenGl/OpenGl_Group.cxx +++ b/src/OpenGl/OpenGl_Group.cxx @@ -332,10 +332,10 @@ void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const const Handle(OpenGl_RenderFilter)& aFilter = theWorkspace->GetRenderFilter(); // Setup aspects - const OpenGl_AspectLine* aBackAspectLine = theWorkspace->AspectLine (Standard_False); - const OpenGl_AspectFace* aBackAspectFace = theWorkspace->AspectFace (Standard_False); - const OpenGl_AspectMarker* aBackAspectMarker = theWorkspace->AspectMarker (Standard_False); - const OpenGl_AspectText* aBackAspectText = theWorkspace->AspectText (Standard_False); + const OpenGl_AspectLine* aBackAspectLine = theWorkspace->AspectLine(); + const OpenGl_AspectFace* aBackAspectFace = theWorkspace->AspectFace(); + const OpenGl_AspectMarker* aBackAspectMarker = theWorkspace->AspectMarker(); + const OpenGl_AspectText* aBackAspectText = theWorkspace->AspectText(); Standard_Boolean isLineSet = myAspectLine && myAspectLine->RenderFiltered (theWorkspace, aFilter); Standard_Boolean isFaceSet = myAspectFace && myAspectFace->RenderFiltered (theWorkspace, aFilter); Standard_Boolean isMarkerSet = myAspectMarker && myAspectMarker->RenderFiltered (theWorkspace, aFilter); diff --git a/src/OpenGl/OpenGl_NamedStatus.hxx b/src/OpenGl/OpenGl_NamedStatus.hxx index c6e557891d..65af7bb7eb 100644 --- a/src/OpenGl/OpenGl_NamedStatus.hxx +++ b/src/OpenGl/OpenGl_NamedStatus.hxx @@ -17,7 +17,6 @@ #define _OpenGl_NamedStatus_Header // Dynamic fields -#define OPENGL_NS_HIGHLIGHT (1<<1) #define OPENGL_NS_RESMAT (1<<2) #define OPENGL_NS_TEXTURE (1<<4) #define OPENGL_NS_ANTIALIASING (1<<5) diff --git a/src/OpenGl/OpenGl_PrimitiveArray.cxx b/src/OpenGl/OpenGl_PrimitiveArray.cxx index 7107c5ecea..2295e3787b 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.cxx @@ -361,7 +361,7 @@ void OpenGl_PrimitiveArray::drawArray (const Handle(OpenGl_Workspace)& theWorksp const Standard_Boolean theHasVertColor) const { const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext(); - const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0; + const bool toHilight = theWorkspace->ToHighlight(); bool hasVColors = theHasVertColor && !toHilight; if (myVboAttribs.IsNull()) { @@ -456,10 +456,8 @@ void OpenGl_PrimitiveArray::drawEdges (const TEL_COLOUR* theEdgeCo } #endif - const OpenGl_AspectLine* anAspectLineOld = NULL; - - anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace (Standard_True)->AspectEdge()); - const OpenGl_AspectLine* anAspect = theWorkspace->AspectLine (Standard_True); + const OpenGl_AspectLine* anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace()->AspectEdge()); + const OpenGl_AspectLine* anAspect = theWorkspace->ApplyAspectLine(); #if !defined(GL_ES_VERSION_2_0) glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); @@ -531,7 +529,7 @@ void OpenGl_PrimitiveArray::drawEdges (const TEL_COLOUR* theEdgeCo // ======================================================================= void OpenGl_PrimitiveArray::drawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const { - const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (Standard_True); + const OpenGl_AspectMarker* anAspectMarker = theWorkspace->ApplyAspectMarker(); const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes (aCtx); if (!aSpriteNorm.IsNull() @@ -692,9 +690,11 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace return; } - const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True); - const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); - const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (myDrawMode == GL_POINTS); + const OpenGl_AspectFace* anAspectFace = theWorkspace->ApplyAspectFace(); + const OpenGl_AspectLine* anAspectLine = theWorkspace->ApplyAspectLine(); + const OpenGl_AspectMarker* anAspectMarker = myDrawMode == GL_POINTS + ? theWorkspace->ApplyAspectMarker() + : theWorkspace->AspectMarker(); // create VBOs on first render call const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); @@ -712,17 +712,6 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace } Tint aFrontLightingModel = anAspectFace->IntFront().color_mask; - const TEL_COLOUR* anInteriorColor = &anAspectFace->IntFront().matcol; - const TEL_COLOUR* anEdgeColor = &anAspectFace->AspectEdge()->Color(); - const TEL_COLOUR* aLineColor = myDrawMode == GL_POINTS ? &anAspectMarker->Color() : &anAspectLine->Color(); - - // Use highlight colors - if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) - { - anEdgeColor = anInteriorColor = aLineColor = theWorkspace->HighlightColor; - aFrontLightingModel = 0; - } - const Standard_Boolean hasColorAttrib = !myVboAttribs.IsNull() && myVboAttribs->HasColorAttribute(); const Standard_Boolean isLightOn = aFrontLightingModel != 0 @@ -752,10 +741,7 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace if ((myDrawMode > GL_LINE_STRIP && anAspectFace->InteriorStyle() != Aspect_IS_EMPTY) || (myDrawMode <= GL_LINE_STRIP)) { - const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0; - const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->InteriorStyle() != Aspect_IS_HIDDENLINE - ? myBounds->Colors - : NULL; + const bool toHilight = theWorkspace->ToHighlight(); const Standard_Boolean hasVertColor = hasColorAttrib && !toHilight; if (aCtx->core20fwd != NULL) { @@ -805,7 +791,7 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace // All primitives should gather material properties from the AspectFace in shading mode if (isLightOn) { - aCtx->SetShadingMaterial (anAspectFace); + aCtx->SetShadingMaterial (anAspectFace, theWorkspace->ToHighlight() ? (const OpenGl_Vec4* )theWorkspace->HighlightColor : NULL); } if (!theWorkspace->ActiveTexture().IsNull() @@ -814,7 +800,16 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace aCtx->SetTextureMatrix (theWorkspace->ActiveTexture()->GetParams()); } - aCtx->SetColor4fv (*(const OpenGl_Vec4* )(myDrawMode <= GL_LINE_STRIP ? aLineColor->rgb : anInteriorColor->rgb)); + if (myDrawMode <= GL_LINE_STRIP) + { + const TEL_COLOUR& aLineColor = myDrawMode == GL_POINTS ? theWorkspace->MarkerColor() : theWorkspace->LineColor(); + aCtx->SetColor4fv (*(const OpenGl_Vec4* )aLineColor.rgb); + } + else + { + const TEL_COLOUR& anInteriorColor = theWorkspace->InteriorColor(); + aCtx->SetColor4fv (*(const OpenGl_Vec4* )anInteriorColor.rgb); + } if (myDrawMode == GL_LINES || myDrawMode == GL_LINE_STRIP) { @@ -822,6 +817,9 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace aCtx->SetLineWidth (anAspectLine->Width()); } + const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->InteriorStyle() != Aspect_IS_HIDDENLINE + ? myBounds->Colors + : NULL; drawArray (theWorkspace, aFaceColors, hasColorAttrib); } @@ -834,6 +832,7 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace if (anAspectFace->Edge() || anAspectFace->InteriorStyle() == Aspect_IS_HIDDENLINE) { + const TEL_COLOUR* anEdgeColor = &theWorkspace->EdgeColor(); drawEdges (anEdgeColor, theWorkspace); // restore OpenGL polygon mode if needed diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx index b8bcc6de20..3fdb86481f 100644 --- a/src/OpenGl/OpenGl_Structure.cxx +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -68,13 +68,12 @@ public: { #if !defined(GL_ES_VERSION_2_0) // Apply line aspect - const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture(); glDisable (GL_LIGHTING); // Use highlight colors - theWorkspace->GetGlContext()->core11->glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb); + theWorkspace->GetGlContext()->core11->glColor3fv (theWorkspace->LineColor().rgb); glEnableClientState (GL_VERTEX_ARRAY); glVertexPointer (3, GL_FLOAT, 0, (GLfloat* )&myVerts); @@ -466,10 +465,9 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); // Render named status - const Standard_Integer aNamedStatus = theWorkspace->NamedStatus; if (highlight) { - theWorkspace->NamedStatus |= OPENGL_NS_HIGHLIGHT; + theWorkspace->SetHighlight (true); } // Apply local transformation @@ -500,11 +498,11 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con // Take into account transform persistence aCtx->ApplyModelViewMatrix(); - // Apply aspects - const OpenGl_AspectLine *anAspectLine = theWorkspace->AspectLine (Standard_False); - const OpenGl_AspectFace *anAspectFace = theWorkspace->AspectFace (Standard_False); - const OpenGl_AspectMarker *anAspectMarker = theWorkspace->AspectMarker (Standard_False); - const OpenGl_AspectText *anAspectText = theWorkspace->AspectText (Standard_False); + // remember aspects + const OpenGl_AspectLine* aPrevAspectLine = theWorkspace->AspectLine(); + const OpenGl_AspectFace* aPrevAspectFace = theWorkspace->AspectFace(); + const OpenGl_AspectMarker* aPrevAspectMarker = theWorkspace->AspectMarker(); + const OpenGl_AspectText* aPrevAspectText = theWorkspace->AspectText(); // Apply correction for mirror transform if (myIsMirrored) @@ -597,10 +595,10 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con theWorkspace->HighlightColor = aHighlightColor; // Restore aspects - theWorkspace->SetAspectLine (anAspectLine); - theWorkspace->SetAspectFace (anAspectFace); - theWorkspace->SetAspectMarker (anAspectMarker); - theWorkspace->SetAspectText (anAspectText); + theWorkspace->SetAspectLine (aPrevAspectLine); + theWorkspace->SetAspectFace (aPrevAspectFace); + theWorkspace->SetAspectMarker (aPrevAspectMarker); + theWorkspace->SetAspectText (aPrevAspectText); // Apply highlight box if (!myHighlightBox.IsNull()) @@ -609,7 +607,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con } // Restore named status - theWorkspace->NamedStatus = aNamedStatus; + theWorkspace->SetHighlight (false); } // ======================================================================= diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx index 1d9de64be3..aa40ca3a45 100644 --- a/src/OpenGl/OpenGl_Text.cxx +++ b/src/OpenGl/OpenGl_Text.cxx @@ -411,7 +411,7 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx, // ======================================================================= void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const { - const OpenGl_AspectText* aTextAspect = theWorkspace->AspectText (Standard_True); + const OpenGl_AspectText* aTextAspect = theWorkspace->ApplyAspectText(); const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture(); const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); @@ -425,24 +425,12 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const myProjMatrix.Convert (aCtx->ProjectionState.Current()); // use highlight color or colors from aspect - if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) - { - render (theWorkspace->PrinterContext(), - aCtx, - *aTextAspect, - *theWorkspace->HighlightColor, - *theWorkspace->HighlightColor, - theWorkspace->View()->RenderingParams().Resolution); - } - else - { - render (theWorkspace->PrinterContext(), - aCtx, - *aTextAspect, - aTextAspect->Color(), - aTextAspect->SubtitleColor(), - theWorkspace->View()->RenderingParams().Resolution); - } + render (theWorkspace->PrinterContext(), + aCtx, + *aTextAspect, + theWorkspace->TextColor(), + theWorkspace->TextSubtitleColor(), + theWorkspace->View()->RenderingParams().Resolution); aCtx->BindProgram (NULL); diff --git a/src/OpenGl/OpenGl_Trihedron.cxx b/src/OpenGl/OpenGl_Trihedron.cxx index e3016d484b..2cd0bf750d 100644 --- a/src/OpenGl/OpenGl_Trihedron.cxx +++ b/src/OpenGl/OpenGl_Trihedron.cxx @@ -196,7 +196,7 @@ void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) con OpenGl_Mat4d aModelViewZ (aModelMatrix); // Set line aspect - const OpenGl_AspectLine* aCurrentAspectLine = theWorkspace->AspectLine (Standard_True); + const OpenGl_AspectLine* aCurrentAspectLine = theWorkspace->ApplyAspectLine(); CALL_DEF_CONTEXTLINE aLineAspect = {1, 1, { 1.F, 1.F, 1.F }, aCurrentAspectLine->Type(), aCurrentAspectLine->Width(), 0}; aLineAspect.Color.r = myZColor.r(); aLineAspect.Color.g = myZColor.g(); @@ -325,7 +325,7 @@ void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspa const GLdouble aScale = myScale * myRatio; - const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); + const OpenGl_AspectLine* anAspectLine = theWorkspace->ApplyAspectLine(); const TEL_COLOUR& aLineColor = anAspectLine->Color(); // Create the trihedron diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx index a4fda7f84b..58a0be673a 100644 --- a/src/OpenGl/OpenGl_Workspace.cxx +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -148,17 +148,18 @@ OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Wi myUseDepthWrite (Standard_True), myUseGLLight (Standard_True), // - AspectLine_set (&myDefaultAspectLine), - AspectLine_applied (NULL), - AspectFace_set (&myDefaultAspectFace), - AspectFace_applied (NULL), - AspectMarker_set (&myDefaultAspectMarker), - AspectMarker_applied (NULL), - AspectText_set (&myDefaultAspectText), - AspectText_applied (NULL), + myAspectLineSet (&myDefaultAspectLine), + myAspectFaceSet (&myDefaultAspectFace), + myAspectFaceApplied (NULL), + myAspectMarkerSet (&myDefaultAspectMarker), + myAspectMarkerApplied (NULL), + myAspectTextSet (&myDefaultAspectText), + myAspectFaceAppliedWithHL (false), + // ViewMatrix_applied (&myDefaultMatrix), StructureMatrix_applied (&myDefaultMatrix), myCullingMode (TelCullUndefined), + myToHighlight (false), myModelViewMatrix (myDefaultMatrix), PolygonOffset_applied (THE_DEFAULT_POFFSET) { @@ -242,22 +243,19 @@ void OpenGl_Workspace::ResetAppliedAspect() NamedStatus = !myTextureBound.IsNull() ? OPENGL_NS_TEXTURE : 0; HighlightColor = &THE_WHITE_COLOR; - AspectLine_set = &myDefaultAspectLine; - AspectLine_applied = NULL; - AspectFace_set = &myDefaultAspectFace; - AspectFace_applied = NULL; - AspectMarker_set = &myDefaultAspectMarker; - AspectMarker_applied = NULL; - AspectText_set = &myDefaultAspectText; - AspectText_applied = NULL; - + myAspectLineSet = &myDefaultAspectLine; + myAspectFaceSet = &myDefaultAspectFace; + myAspectFaceApplied = NULL; + myAspectMarkerSet = &myDefaultAspectMarker; + myAspectMarkerApplied = NULL; + myAspectTextSet = &myDefaultAspectText; PolygonOffset_applied = THE_DEFAULT_POFFSET; myCullingMode = TelCullUndefined; - AspectLine(Standard_True); - AspectFace(Standard_True); - AspectMarker(Standard_True); - AspectText(Standard_True); + ApplyAspectLine(); + ApplyAspectFace(); + ApplyAspectMarker(); + ApplyAspectText(); myGlContext->SetTypeOfLine (myDefaultAspectLine.Type()); myGlContext->SetLineWidth (myDefaultAspectLine.Width()); @@ -648,31 +646,35 @@ static void TelUpdatePolygonOffsets (const TEL_POFFSET_PARAM& theOffsetData) void OpenGl_Workspace::updateMaterial (const int theFlag) { // Case of hidden line - if (AspectFace_set->InteriorStyle() == Aspect_IS_HIDDENLINE) + if (myAspectFaceSet->InteriorStyle() == Aspect_IS_HIDDENLINE) { - myAspectFaceHl = *AspectFace_set; // copy all values including line edge aspect + myAspectFaceHl = *myAspectFaceSet; // copy all values including line edge aspect myAspectFaceHl.ChangeIntFront().matcol = myView->BackgroundColor(); myAspectFaceHl.ChangeIntFront().color_mask = 0; myAspectFaceHl.ChangeIntFront().color_mask = 0; - AspectFace_set = &myAspectFaceHl; + myAspectFaceSet = &myAspectFaceHl; return; } - const OPENGL_SURF_PROP* aProps = &AspectFace_set->IntFront(); + const OPENGL_SURF_PROP* aProps = &myAspectFaceSet->IntFront(); GLenum aFace = GL_FRONT_AND_BACK; if (theFlag == TEL_BACK_MATERIAL) { aFace = GL_BACK; - aProps = &AspectFace_set->IntBack(); + aProps = &myAspectFaceSet->IntBack(); } - else if (AspectFace_set->DistinguishingMode() == TOn + else if (myAspectFaceSet->DistinguishingMode() == TOn && !(NamedStatus & OPENGL_NS_RESMAT)) { aFace = GL_FRONT; } myMatTmp.Init (*aProps); + if (myToHighlight) + { + myMatTmp.SetColor (*(const OpenGl_Vec4* )HighlightColor); + } // handling transparency if (NamedStatus & OPENGL_NS_2NDPASSDO) @@ -798,83 +800,64 @@ void OpenGl_Workspace::updateMaterial (const int theFlag) // function : SetAspectLine // purpose : // ======================================================================= -const OpenGl_AspectLine * OpenGl_Workspace::SetAspectLine(const OpenGl_AspectLine *AnAspect) +const OpenGl_AspectLine* OpenGl_Workspace::SetAspectLine (const OpenGl_AspectLine* theAspect) { - const OpenGl_AspectLine *AspectLine_old = AspectLine_set; - AspectLine_set = AnAspect; - return AspectLine_old; + const OpenGl_AspectLine* aPrevAspectLine = myAspectLineSet; + myAspectLineSet = theAspect; + return aPrevAspectLine; } // ======================================================================= // function : SetAspectFace // purpose : // ======================================================================= -const OpenGl_AspectFace * OpenGl_Workspace::SetAspectFace(const OpenGl_AspectFace *AnAspect) +const OpenGl_AspectFace * OpenGl_Workspace::SetAspectFace (const OpenGl_AspectFace* theAspect) { - const OpenGl_AspectFace *AspectFace_old = AspectFace_set; - AspectFace_set = AnAspect; - return AspectFace_old; + const OpenGl_AspectFace* aPrevAspectFace = myAspectFaceSet; + myAspectFaceSet = theAspect; + return aPrevAspectFace; } // ======================================================================= // function : SetAspectMarker // purpose : // ======================================================================= -const OpenGl_AspectMarker * OpenGl_Workspace::SetAspectMarker(const OpenGl_AspectMarker *AnAspect) +const OpenGl_AspectMarker* OpenGl_Workspace::SetAspectMarker (const OpenGl_AspectMarker* theAspect) { - const OpenGl_AspectMarker *AspectMarker_old = AspectMarker_set; - AspectMarker_set = AnAspect; - return AspectMarker_old; + const OpenGl_AspectMarker* aPrevAspectMarker = myAspectMarkerSet; + myAspectMarkerSet = theAspect; + return aPrevAspectMarker; } // ======================================================================= // function : SetAspectText // purpose : // ======================================================================= -const OpenGl_AspectText * OpenGl_Workspace::SetAspectText(const OpenGl_AspectText *AnAspect) +const OpenGl_AspectText * OpenGl_Workspace::SetAspectText (const OpenGl_AspectText* theAspect) { - const OpenGl_AspectText *AspectText_old = AspectText_set; - AspectText_set = AnAspect; - return AspectText_old; + const OpenGl_AspectText* aPrevAspectText = myAspectTextSet; + myAspectTextSet = theAspect; + return aPrevAspectText; } // ======================================================================= -// function : AspectLine +// function : ApplyAspectFace // purpose : // ======================================================================= -const OpenGl_AspectLine * OpenGl_Workspace::AspectLine(const Standard_Boolean theWithApply) +const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace() { - if (theWithApply) - { - AspectLine_applied = AspectLine_set; - } - - return AspectLine_set; -} - -// ======================================================================= -// function : AspectFace -// purpose : -// ======================================================================= -const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean theToApply) -{ - if (!theToApply) - { - return AspectFace_set; - } - if (myView->BackfacingModel() == Graphic3d_TOBM_AUTOMATIC) { // manage back face culling mode, disable culling when clipping is enabled TelCullMode aCullingMode = (myGlContext->Clipping().IsClippingOrCappingOn() - || AspectFace_set->InteriorStyle() == Aspect_IS_HATCH) + || myAspectFaceSet->InteriorStyle() == Aspect_IS_HATCH) ? TelCullNone - : (TelCullMode )AspectFace_set->CullingMode(); + : (TelCullMode )myAspectFaceSet->CullingMode(); if (aCullingMode != TelCullNone && !(NamedStatus & OPENGL_NS_2NDPASSDO)) { // disable culling in case of translucent shading aspect - if (AspectFace_set->IntFront().trans != 1.0f) + if (myAspectFaceSet->IntFront().trans != 1.0f) { aCullingMode = TelCullNone; } @@ -906,14 +889,17 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th } } - if (AspectFace_set == AspectFace_applied) + if (myAspectFaceSet == myAspectFaceApplied + && myToHighlight == myAspectFaceAppliedWithHL) { - return AspectFace_set; + return myAspectFaceSet; } + myAspectFaceAppliedWithHL = myToHighlight; #if !defined(GL_ES_VERSION_2_0) - const Aspect_InteriorStyle anIntstyle = AspectFace_set->InteriorStyle(); - if (AspectFace_applied == NULL || AspectFace_applied->InteriorStyle() != anIntstyle) + const Aspect_InteriorStyle anIntstyle = myAspectFaceSet->InteriorStyle(); + if (myAspectFaceApplied == NULL + || myAspectFaceApplied->InteriorStyle() != anIntstyle) { switch (anIntstyle) { @@ -926,7 +912,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th case Aspect_IS_HATCH: { glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); - myLineAttribs->SetTypeOfHatch (AspectFace_applied != NULL ? AspectFace_applied->Hatch() : TEL_HS_SOLID); + myLineAttribs->SetTypeOfHatch (myAspectFaceApplied != NULL ? myAspectFaceApplied->Hatch() : TEL_HS_SOLID); break; } case Aspect_IS_SOLID: @@ -949,8 +935,9 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th if (anIntstyle == Aspect_IS_HATCH) { - const Tint hatchstyle = AspectFace_set->Hatch(); - if (AspectFace_applied == NULL || AspectFace_applied->Hatch() != hatchstyle) + const Tint hatchstyle = myAspectFaceSet->Hatch(); + if (myAspectFaceApplied == NULL + || myAspectFaceApplied->Hatch() != hatchstyle) { myLineAttribs->SetTypeOfHatch (hatchstyle); } @@ -958,28 +945,28 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th #endif // Aspect_POM_None means: do not change current settings - if ((AspectFace_set->PolygonOffset().mode & Aspect_POM_None) != Aspect_POM_None) + if ((myAspectFaceSet->PolygonOffset().mode & Aspect_POM_None) != Aspect_POM_None) { - if (PolygonOffset_applied.mode != AspectFace_set->PolygonOffset().mode - || PolygonOffset_applied.factor != AspectFace_set->PolygonOffset().factor - || PolygonOffset_applied.units != AspectFace_set->PolygonOffset().units) + if (PolygonOffset_applied.mode != myAspectFaceSet->PolygonOffset().mode + || PolygonOffset_applied.factor != myAspectFaceSet->PolygonOffset().factor + || PolygonOffset_applied.units != myAspectFaceSet->PolygonOffset().units) { - SetPolygonOffset (AspectFace_set->PolygonOffset().mode, - AspectFace_set->PolygonOffset().factor, - AspectFace_set->PolygonOffset().units); + SetPolygonOffset (myAspectFaceSet->PolygonOffset().mode, + myAspectFaceSet->PolygonOffset().factor, + myAspectFaceSet->PolygonOffset().units); } } updateMaterial (TEL_FRONT_MATERIAL); - if (AspectFace_set->DistinguishingMode() == TOn) + if (myAspectFaceSet->DistinguishingMode() == TOn) { updateMaterial (TEL_BACK_MATERIAL); } - if (AspectFace_set->DoTextureMap()) + if (myAspectFaceSet->DoTextureMap()) { - EnableTexture (AspectFace_set->TextureRes (myGlContext), - AspectFace_set->TextureParams()); + EnableTexture (myAspectFaceSet->TextureRes (myGlContext), + myAspectFaceSet->TextureParams()); } else { @@ -994,8 +981,8 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th } } - AspectFace_applied = AspectFace_set; - return AspectFace_set; + myAspectFaceApplied = myAspectFaceSet; + return myAspectFaceSet; } //======================================================================= @@ -1014,39 +1001,26 @@ void OpenGl_Workspace::SetPolygonOffset (int theMode, } // ======================================================================= -// function : AspectMarker +// function : ApplyAspectMarker // purpose : // ======================================================================= -const OpenGl_AspectMarker* OpenGl_Workspace::AspectMarker (const Standard_Boolean theToApply) +const OpenGl_AspectMarker* OpenGl_Workspace::ApplyAspectMarker() { - if (theToApply && (AspectMarker_set != AspectMarker_applied)) + if (myAspectMarkerSet != myAspectMarkerApplied) { - if (!AspectMarker_applied || (AspectMarker_set->Scale() != AspectMarker_applied->Scale())) + if (myAspectMarkerApplied == NULL + || (myAspectMarkerSet->Scale() != myAspectMarkerApplied->Scale())) { #if !defined(GL_ES_VERSION_2_0) - glPointSize (AspectMarker_set->Scale()); + glPointSize (myAspectMarkerSet->Scale()); #ifdef HAVE_GL2PS - gl2psPointSize (AspectMarker_set->Scale()); + gl2psPointSize (myAspectMarkerSet->Scale()); #endif #endif } - AspectMarker_applied = AspectMarker_set; + myAspectMarkerApplied = myAspectMarkerSet; } - return AspectMarker_set; -} - -// ======================================================================= -// function : AspectText -// purpose : -// ======================================================================= -const OpenGl_AspectText* OpenGl_Workspace::AspectText (const Standard_Boolean theWithApply) -{ - if (theWithApply) - { - AspectText_applied = AspectText_set; - } - - return AspectText_set; + return myAspectMarkerSet; } // ======================================================================= diff --git a/src/OpenGl/OpenGl_Workspace.hxx b/src/OpenGl/OpenGl_Workspace.hxx index 57d11d2d57..f41f4a0883 100644 --- a/src/OpenGl/OpenGl_Workspace.hxx +++ b/src/OpenGl/OpenGl_Workspace.hxx @@ -35,10 +35,6 @@ #include #include -class OpenGl_AspectLine; -class OpenGl_AspectMarker; -class OpenGl_AspectText; -class OpenGl_Element; class OpenGl_View; class Image_PixMap; @@ -58,6 +54,14 @@ struct OpenGl_Material Standard_ShortReal Transparency() const { return Params.y(); } Standard_ShortReal& ChangeTransparency() { return Params.y(); } + //! Set material color. + void SetColor (const OpenGl_Vec4& theColor) + { + // apply the same formula as in Graphic3d_MaterialAspect::SetColor() + Ambient.xyz() = theColor.rgb() * 0.25f; + Diffuse.xyz() = theColor.rgb(); + } + //! Initialize material void Init (const OPENGL_SURF_PROP& theProps); @@ -171,18 +175,101 @@ public: const TEL_COLOUR* HighlightColor; + //! Return true if following structures should apply highlight color. + bool ToHighlight() const { return myToHighlight; } + + //! Set highlight. + void SetHighlight (bool theToHighlight) { myToHighlight = theToHighlight; } + + //! Return line color taking into account highlight flag. + const TEL_COLOUR& LineColor() const + { + return myToHighlight + ? *HighlightColor + : myAspectLineSet->Color(); + } + + //! Return edge color taking into account highlight flag. + const TEL_COLOUR& EdgeColor() const + { + return myToHighlight + ? *HighlightColor + : myAspectFaceSet->AspectEdge()->Color(); + } + + //! Return marker color taking into account highlight flag. + const TEL_COLOUR& MarkerColor() const + { + return myToHighlight + ? *HighlightColor + : myAspectMarkerSet->Color(); + } + + //! Return Interior color taking into account highlight flag. + const TEL_COLOUR& InteriorColor() const + { + return myToHighlight + ? *HighlightColor + : myAspectFaceSet->IntFront().matcol; + } + + //! Return text color taking into account highlight flag. + const TEL_COLOUR& TextColor() const + { + return myToHighlight + ? *HighlightColor + : myAspectTextSet->Color(); + } + + //! Return text Subtitle color taking into account highlight flag. + const TEL_COLOUR& TextSubtitleColor() const + { + return myToHighlight + ? *HighlightColor + : myAspectTextSet->SubtitleColor(); + } + + //! Currently set line aspect (can differ from applied). + const OpenGl_AspectLine* AspectLine() const { return myAspectLineSet; } + + //! Currently set face aspect (can differ from applied). + const OpenGl_AspectFace* AspectFace() const { return myAspectFaceSet; } + + //! Currently set marker aspect (can differ from applied). + const OpenGl_AspectMarker* AspectMarker() const { return myAspectMarkerSet; } + + //! Currently set text aspect (can differ from applied). + const OpenGl_AspectText* AspectText() const { return myAspectTextSet; } + + //! Assign new line aspect (will be applied within ApplyAspectLine()). Standard_EXPORT const OpenGl_AspectLine* SetAspectLine (const OpenGl_AspectLine* theAspect); + + //! Assign new face aspect (will be applied within ApplyAspectFace()). Standard_EXPORT const OpenGl_AspectFace* SetAspectFace (const OpenGl_AspectFace* theAspect); + + //! Assign new marker aspect (will be applied within ApplyAspectMarker()). Standard_EXPORT const OpenGl_AspectMarker* SetAspectMarker (const OpenGl_AspectMarker* theAspect); + + //! Assign new text aspect (will be applied within ApplyAspectText()). Standard_EXPORT const OpenGl_AspectText* SetAspectText (const OpenGl_AspectText* theAspect); - //// THESE METHODS ARE EXPORTED AS THEY PROVIDE STATE INFO TO USERDRAW - Standard_EXPORT const OpenGl_AspectLine* AspectLine (const Standard_Boolean theWithApply); - Standard_EXPORT const OpenGl_AspectFace* AspectFace (const Standard_Boolean theWithApply); - Standard_EXPORT const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply); - Standard_EXPORT const OpenGl_AspectText* AspectText (const Standard_Boolean theWithApply); + //! Apply line aspect. + //! @return aspect set by SetAspectLine() + const OpenGl_AspectLine* ApplyAspectLine() { return myAspectLineSet; } - //! Clear the applied aspect state. + //! Apply face aspect. + //! @return aspect set by SetAspectFace() + Standard_EXPORT const OpenGl_AspectFace* ApplyAspectFace(); + + //! Apply marker aspect. + //! @return aspect set by SetAspectMarker() + Standard_EXPORT const OpenGl_AspectMarker* ApplyAspectMarker(); + + //! Apply text aspect. + //! @return aspect set by SetAspectText() + const OpenGl_AspectText* ApplyAspectText() { return myAspectTextSet; } + + //! Clear the applied aspect state to default values. void ResetAppliedAspect(); Standard_EXPORT Handle(OpenGl_Texture) DisableTexture(); @@ -274,10 +361,13 @@ protected: //! @name fields related to status Handle(OpenGl_RenderFilter) myRenderFilter; Handle(OpenGl_Texture) myTextureBound; //!< currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) - const OpenGl_AspectLine *AspectLine_set, *AspectLine_applied; - const OpenGl_AspectFace *AspectFace_set, *AspectFace_applied; - const OpenGl_AspectMarker *AspectMarker_set, *AspectMarker_applied; - const OpenGl_AspectText *AspectText_set, *AspectText_applied; + const OpenGl_AspectLine* myAspectLineSet; + const OpenGl_AspectFace* myAspectFaceSet; + const OpenGl_AspectFace* myAspectFaceApplied; + const OpenGl_AspectMarker* myAspectMarkerSet; + const OpenGl_AspectMarker* myAspectMarkerApplied; + const OpenGl_AspectText* myAspectTextSet; + bool myAspectFaceAppliedWithHL; const OpenGl_Matrix* ViewMatrix_applied; const OpenGl_Matrix* StructureMatrix_applied; @@ -286,6 +376,7 @@ protected: //! @name fields related to status OpenGl_Material myMatBack; //!< current back material state OpenGl_Material myMatTmp; //!< temporary variable TelCullMode myCullingMode; //!< back face culling mode, applied from face aspect + bool myToHighlight; //!< flag indicating highlighting mode OpenGl_Matrix myModelViewMatrix; //!< Model matrix with applied structure transformations diff --git a/src/ViewerTest/ViewerTest_OpenGlCommands.cxx b/src/ViewerTest/ViewerTest_OpenGlCommands.cxx index dca94bf4c8..b4ace70a15 100644 --- a/src/ViewerTest/ViewerTest_OpenGlCommands.cxx +++ b/src/ViewerTest/ViewerTest_OpenGlCommands.cxx @@ -159,13 +159,11 @@ void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const aCtx->BindProgram (NULL); // To test linking against OpenGl_Workspace and all aspect classes - const OpenGl_AspectLine* aLA = theWorkspace->AspectLine(0); - const OpenGl_AspectMarker* aMA = theWorkspace->AspectMarker(0); + const OpenGl_AspectMarker* aMA = theWorkspace->AspectMarker(); aMA->Type(); - const OpenGl_AspectText* aTA = theWorkspace->AspectText(0); + const OpenGl_AspectText* aTA = theWorkspace->AspectText(); aTA->FontName(); - TEL_COLOUR aColor = theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ? - *(theWorkspace->HighlightColor) : aLA->Color(); + TEL_COLOUR aColor = theWorkspace->LineColor(); // Finally draw something to make sure UserDraw really works glPushAttrib(GL_ENABLE_BIT); diff --git a/tests/bugs/vis/bug22018 b/tests/bugs/vis/bug22018 index 7c3f8af0de..7ee4b7dfb9 100755 --- a/tests/bugs/vis/bug22018 +++ b/tests/bugs/vis/bug22018 @@ -42,20 +42,28 @@ set y 200 vmoveto 0 0 vmoveto 0 0 -checkcolor ${x1} ${y} ${White_R} ${White_G} ${White_B} -checkcolor ${x2} ${y} ${White_R} ${White_G} ${White_B} +if { [vreadpixel $x1 $y rgb name] != "IVORY" || [vreadpixel $x2 $y rgb name] != "IVORY" } { + Error: unexpected color of not selected object +} vmoveto ${x1} ${y} vmoveto ${x1} ${y} -checkcolor ${x1} ${y} ${Select_R} ${Select_G} ${Select_B} -checkcolor ${x2} ${y} ${White_R} ${White_G} ${White_B} +if { [vreadpixel $x1 $y rgb name] != "WHITE" } { + Error: unexpected color of selected object +} +if { [vreadpixel $x2 $y rgb name] != "IVORY" } { + Error: unexpected color of not selected object +} vmoveto ${x2} ${y} vmoveto ${x2} ${y} -checkcolor ${x1} ${y} ${White_R} ${White_G} ${White_B} -checkcolor ${x2} ${y} ${Select_R} ${Select_G} ${Select_B} +if { [vreadpixel $x1 $y rgb name] != "IVORY" } { + Error: unexpected color of not selected object +} +if { [vreadpixel $x2 $y rgb name] != "WHITE" } { + Error: unexpected color of selected object +} checkview -screenshot -3d -path ${imagedir}/${test_image}.png - diff --git a/tests/bugs/vis/bug26217 b/tests/bugs/vis/bug26217 index 5fb9e00803..047f7065b2 100644 --- a/tests/bugs/vis/bug26217 +++ b/tests/bugs/vis/bug26217 @@ -26,7 +26,7 @@ vselect 0 0 vselect 40 120 185 320 -allowoverlap 1 set aColor [vreadpixel 120 200 rgb name] -if {$aColor != "GRAY80"} { +if {$aColor != "GRAY66"} { puts "ERROR: the circle is not selected with overlap mode activated" } diff --git a/tests/bugs/vis/bug26680 b/tests/bugs/vis/bug26680 index f3ba1f8e90..73db38ba25 100644 --- a/tests/bugs/vis/bug26680 +++ b/tests/bugs/vis/bug26680 @@ -16,20 +16,20 @@ meshcolors m elem2 1 vselmode 0 1 vmoveto 200 200 -if {[vreadpixel 197 257 name] != "CYAN1 1"} { +if {[vreadpixel 197 257 rgb name] != "CYAN1"} { puts "ERROR: presentation for dynamic highlight of the object is wrong!" } vmoveto 0 0 -if {[vreadpixel 197 257 name] != "BLUE2 1"} { +if {[vreadpixel 197 257 rgb name] != "BLUE2"} { puts "ERROR: the object is not unhighlighted after dynamic highlight!" } vselect 200 200 -if {[vreadpixel 197 257 name] != "GRAY80 1"} { +if {[vreadpixel 197 257 rgb name] != "GRAY93"} { puts "ERROR: presentation for selection highlight is wrong!" } vselect 0 0 -if {[vreadpixel 197 257 name] != "BLUE2 1"} { +if {[vreadpixel 197 257 rgb name] != "BLUE2"} { puts "ERROR: the object is not unhighlighted after selection highlight!" } diff --git a/tests/bugs/vis/bug26960 b/tests/bugs/vis/bug26960 index 4f7beb76b4..9c19f28c67 100644 --- a/tests/bugs/vis/bug26960 +++ b/tests/bugs/vis/bug26960 @@ -21,7 +21,7 @@ if {[vreadpixel 350 140 rgb name] != "BLACK"} { puts "ERROR: wrong inital location" } vsetlocation b 0.5 0 0 -if {[vreadpixel 350 140 rgb name] != "CYAN1"} { +if {[vreadpixel 350 140 rgb name] != "DARKTURQUOISE"} { puts "ERROR: the transformation was not applied to highlight structure" } diff --git a/tests/v3d/materials/bug27617 b/tests/v3d/materials/bug27617 new file mode 100644 index 0000000000..9f3c000fc4 --- /dev/null +++ b/tests/v3d/materials/bug27617 @@ -0,0 +1,18 @@ +puts "========" +puts "OCC27617: Visualization, TKOpenGl - apply highlighting color without disabling lighting" +puts "========" + +pload MODELING VISUALIZATION +box b 1 2 3 +vclear +vinit View1 +vdisplay -highMode 1 -dispMode 1 b +vaxo +vfit +vrotate 1 0 0 +vfit +vmoveto 250 150 +set aColor [vreadpixel 200 150 name rgb] +if { "$aColor" != "TURQUOISE4" } { + puts "Error: Wrong dynamic highlight color" +}