1 // Created on: 2011-10-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <OpenGl_GraphicDriver.hxx>
18 #include <TColStd_HArray1OfByte.hxx>
20 #include <OpenGl_Display.hxx>
21 #include <OpenGl_Structure.hxx>
23 void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& theCGroup)
25 if (theCGroup.ptrGroup == NULL)
28 ((OpenGl_Group* )theCGroup.ptrGroup)->Release (GetSharedContext());
31 void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
32 const Standard_Integer theNoInsert)
34 if (!theCGroup.ContextFillArea.IsDef || theCGroup.ptrGroup == NULL)
37 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectFace (theCGroup.ContextFillArea, theNoInsert);
40 void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
42 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
43 if (aStructure != NULL)
45 theCGroup.ptrGroup = aStructure->AddGroup();
49 void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& theCGroup,
50 const Standard_Integer theNoInsert)
52 if (!theCGroup.ContextLine.IsDef || theCGroup.ptrGroup == NULL) return;
54 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectLine (theCGroup.ContextLine, theNoInsert);
57 void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
58 const Standard_Integer theNoInsert)
60 if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return;
62 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
65 void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
67 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
68 if (aStructure == NULL)
71 aStructure->RemoveGroup (GetSharedContext(), (const OpenGl_Group* )theCGroup.ptrGroup);
74 void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& theCGroup,
75 const Standard_Integer theNoInsert)
77 if (!theCGroup.ContextText.IsDef || theCGroup.ptrGroup == NULL)
80 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectText (theCGroup.ContextText, theNoInsert);