Commit | Line | Data |
---|---|---|
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 | // |
973c2be1 | 7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public 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. | |
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 SK |
18 | #include <OpenGl_Group.hxx> |
19 | #include <OpenGl_PrimitiveArray.hxx> | |
7fd59977 | 20 | |
2166f0fa | 21 | #include <OpenGl_CView.hxx> |
7fd59977 | 22 | |
2166f0fa | 23 | void OpenGl_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView& ACView, const Standard_Boolean isEnabled ) const |
7fd59977 | 24 | { |
2166f0fa SK |
25 | const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; |
26 | if (aCView) | |
27 | aCView->WS->UseDepthTest() = isEnabled; | |
7fd59977 | 28 | } |
29 | ||
2166f0fa | 30 | Standard_Boolean OpenGl_GraphicDriver::IsDepthTestEnabled( const Graphic3d_CView& ACView ) const |
7fd59977 | 31 | { |
2166f0fa SK |
32 | const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; |
33 | if (aCView) | |
34 | return aCView->WS->UseDepthTest(); | |
35 | return Standard_False; | |
7fd59977 | 36 | } |
37 | ||
2166f0fa SK |
38 | void OpenGl_GraphicDriver::ReadDepths( const Graphic3d_CView& ACView, |
39 | const Standard_Integer x, | |
40 | const Standard_Integer y, | |
41 | const Standard_Integer width, | |
42 | const Standard_Integer height, | |
43 | const Standard_Address buffer ) const | |
7fd59977 | 44 | { |
2166f0fa SK |
45 | const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; |
46 | if (aCView) | |
47 | aCView->WS->ReadDepths(x, y, width, height, (float*) buffer); | |
7fd59977 | 48 | } |
49 | ||
2166f0fa | 50 | void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& ACView, const Standard_Boolean isEnabled ) const |
7fd59977 | 51 | { |
2166f0fa SK |
52 | const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; |
53 | if (aCView) | |
54 | aCView->WS->UseGLLight() = isEnabled; | |
7fd59977 | 55 | } |
56 | ||
2166f0fa | 57 | Standard_Boolean OpenGl_GraphicDriver::IsGLLightEnabled( const Graphic3d_CView& ACView ) const |
7fd59977 | 58 | { |
2166f0fa SK |
59 | const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; |
60 | if (aCView) | |
61 | return aCView->WS->UseGLLight(); | |
62 | return Standard_False; | |
7fd59977 | 63 | } |
64 | ||
2166f0fa SK |
65 | void OpenGl_GraphicDriver::PrimitiveArray( const Graphic3d_CGroup& ACGroup, |
66 | const Graphic3d_PrimitiveArray& parray, | |
35e08fe8 | 67 | const Standard_Boolean /*EvalMinMax*/ ) |
7fd59977 | 68 | { |
2166f0fa SK |
69 | if ( ACGroup.ptrGroup && parray ) |
70 | { | |
71 | OpenGl_PrimitiveArray *aparray = new OpenGl_PrimitiveArray( (CALL_DEF_PARRAY *) parray ); | |
72 | ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelParray, aparray ); | |
73 | } | |
7fd59977 | 74 | } |
75 | ||
5e27df78 | 76 | void OpenGl_GraphicDriver::UserDraw (const Graphic3d_CGroup& theCGroup, |
77 | const Graphic3d_CUserDraw& theUserDraw) | |
2166f0fa | 78 | { |
5e27df78 | 79 | if (theCGroup.ptrGroup != NULL |
80 | && myUserDrawCallback != NULL) | |
2166f0fa | 81 | { |
5e27df78 | 82 | OpenGl_Element* aUserDraw = myUserDrawCallback(&theUserDraw); |
83 | if (aUserDraw != NULL) | |
84 | { | |
85 | ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelUserdraw, aUserDraw); | |
86 | } | |
2166f0fa | 87 | } |
7fd59977 | 88 | } |