1 // File: OpenGl_GraphicDriver_3.cxx
2 // Created: 20 October 2011
3 // Author: Sergey ZERCHANINOV
4 // Copyright: OPEN CASCADE 2011
6 #include <OpenGl_GraphicDriver.hxx>
8 #include <TColStd_HArray1OfByte.hxx>
10 #include <OpenGl_Display.hxx>
11 #include <OpenGl_Structure.hxx>
13 void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& theCGroup)
15 if (theCGroup.ptrGroup == NULL)
18 ((OpenGl_Group* )theCGroup.ptrGroup)->Clear();
19 InvalidateAllWorkspaces();
22 void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& )
27 void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
28 const Standard_Integer theNoInsert)
30 if (!theCGroup.ContextFillArea.IsDef || theCGroup.ptrGroup == NULL)
33 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectFace (theCGroup.ContextFillArea, theNoInsert);
34 InvalidateAllWorkspaces();
37 void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
39 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
42 theCGroup.ptrGroup = aStructure->AddGroup();
43 InvalidateAllWorkspaces();
47 void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& theCGroup,
48 const Standard_Integer theNoInsert)
50 if (!theCGroup.ContextLine.IsDef || theCGroup.ptrGroup == NULL) return;
52 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectLine (theCGroup.ContextLine, theNoInsert);
53 InvalidateAllWorkspaces();
56 void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
57 const Standard_Integer theNoInsert)
59 if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return;
61 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
62 InvalidateAllWorkspaces();
65 void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
66 const Standard_Integer theNoInsert,
67 const Standard_Integer theMarkWidth,
68 const Standard_Integer theMarkHeight,
69 const Handle(TColStd_HArray1OfByte)& theTexture)
71 if(!theCGroup.ContextMarker.IsDef)
74 if (!openglDisplay.IsNull())
75 openglDisplay->AddUserMarker ((int )theCGroup.ContextMarker.Scale, theMarkWidth, theMarkHeight, theTexture);
77 if (theCGroup.ptrGroup != NULL)
79 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
80 InvalidateAllWorkspaces();
84 void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& )
89 void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
91 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
92 if (aStructure == NULL)
95 aStructure->RemoveGroup ((const OpenGl_Group* )theCGroup.ptrGroup);
96 InvalidateAllWorkspaces();
99 void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& theCGroup,
100 const Standard_Integer theNoInsert)
102 if (!theCGroup.ContextText.IsDef || theCGroup.ptrGroup == NULL)
105 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectText (theCGroup.ContextText, theNoInsert);
106 InvalidateAllWorkspaces();