0024637: Visualization - clean up implementation of rendering in immediate mode
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_3.cxx
CommitLineData
b311480e 1// Created on: 2011-10-20
2// Created by: Sergey ZERCHANINOV
973c2be1 3// Copyright (c) 2011-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
2166f0fa 16#include <OpenGl_GraphicDriver.hxx>
7fd59977 17
2166f0fa 18#include <TColStd_HArray1OfByte.hxx>
7fd59977 19
2166f0fa
SK
20#include <OpenGl_Display.hxx>
21#include <OpenGl_Structure.hxx>
7fd59977 22
2166f0fa
SK
23void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& theCGroup)
24{
25 if (theCGroup.ptrGroup == NULL)
26 return;
7fd59977 27
5e27df78 28 ((OpenGl_Group* )theCGroup.ptrGroup)->Release (GetSharedContext());
7fd59977 29}
30
2166f0fa
SK
31void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
32 const Standard_Integer theNoInsert)
33{
34 if (!theCGroup.ContextFillArea.IsDef || theCGroup.ptrGroup == NULL)
35 return;
7fd59977 36
fd4a6963 37 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectFace (theCGroup.ContextFillArea, theNoInsert);
7fd59977 38}
39
2166f0fa
SK
40void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
41{
63bcc448 42 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
43 if (aStructure != NULL)
2166f0fa
SK
44 {
45 theCGroup.ptrGroup = aStructure->AddGroup();
7fd59977 46 }
7fd59977 47}
48
2166f0fa
SK
49void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& theCGroup,
50 const Standard_Integer theNoInsert)
51{
52 if (!theCGroup.ContextLine.IsDef || theCGroup.ptrGroup == NULL) return;
7fd59977 53
2166f0fa 54 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectLine (theCGroup.ContextLine, theNoInsert);
7fd59977 55}
56
2166f0fa
SK
57void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
58 const Standard_Integer theNoInsert)
59{
60 if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return;
7fd59977 61
fd4a6963 62 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
7fd59977 63}
64
2166f0fa
SK
65void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
66{
63bcc448 67 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
2166f0fa
SK
68 if (aStructure == NULL)
69 return;
7fd59977 70
5e27df78 71 aStructure->RemoveGroup (GetSharedContext(), (const OpenGl_Group* )theCGroup.ptrGroup);
7fd59977 72}
73
2166f0fa
SK
74void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& theCGroup,
75 const Standard_Integer theNoInsert)
76{
77 if (!theCGroup.ContextText.IsDef || theCGroup.ptrGroup == NULL)
78 return;
7fd59977 79
2166f0fa 80 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectText (theCGroup.ContextText, theNoInsert);
7fd59977 81}