0024847: CLang warnings -Wdeprecated-writable-strings in OpenGl_Display
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_Layer.cxx
index 4d5eb69..999b877 100644 (file)
 
 #include <Font_FontAspect.hxx>
 
-#include <OpenGl_Display.hxx>
 #include <OpenGl_AspectText.hxx>
 #include <OpenGl_Text.hxx>
 #include <OpenGl_TextParam.hxx>
+#include <OpenGl_LineAttributes.hxx>
 
 /*----------------------------------------------------------------------*/
 
@@ -223,19 +223,29 @@ void OpenGl_GraphicDriver::UnsetTransparency ()
   glDisable (GL_BLEND);
 }
 
-void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width)
+void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer   theType,
+                                              const Standard_ShortReal theWidth)
 {
-  if (!TheLayerProp.ListId || myGlDisplay.IsNull()) return;
+  const Handle(OpenGl_Context)& aCtx = GetSharedContext();
+  if (!TheLayerProp.ListId
+   || aCtx.IsNull())
+  {
+    return;
+  }
 
-  if (TheLayerProp.LineType != Type)
+  if (TheLayerProp.LineType != theType)
   {
-    TheLayerProp.LineType = Type;
-    myGlDisplay->SetTypeOfLine((Aspect_TypeOfLine) Type);
+    Handle(OpenGl_LineAttributes) aLineAttribs;
+    if (aCtx->GetResource ("OpenGl_LineAttributes", aLineAttribs))
+    {
+      TheLayerProp.LineType = theType;
+      aLineAttribs->SetTypeOfLine ((Aspect_TypeOfLine )theType);
+    }
   }
-  if (TheLayerProp.LineWidth != Width)
+  if (TheLayerProp.LineWidth != theWidth)
   {
-    TheLayerProp.LineWidth = Width;
-    glLineWidth ((GLfloatWidth);
+    TheLayerProp.LineWidth = theWidth;
+    glLineWidth ((GLfloat )theWidth);
   }
 }