f97e60a7bdf2b7273ab1afdd2200818fd1677f4b
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_713.cxx
1 // File         OpenGl_GraphicDriver_713.cxx
2 // Created      22-10-01
3 // Author       SAV
4
5 // SAV 09/07/02 merged with OpenGl_GraphicDriver_713.cxx created 16/06/2000 by ATS,SPK,GG : G005
6 //              implementation of PARRAY method
7
8 #include <OpenGl_GraphicDriver.jxx>
9
10 #include <Aspect_DriverDefinitionError.hxx>
11
12
13 #include <OpenGl_tgl_funcs.hxx>
14 #include <OpenGl_telem_util.hxx>
15
16
17 #define  BUC61044    /* 25/10/01 SAV ; added functionality to control gl depth testing
18 from higher API */
19 #define  BUC61045    /* 25/10/01 SAV ; added functionality to control gl lighting 
20 from higher API */
21
22
23 void OpenGl_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView& view,
24                                                const Standard_Boolean isEnabled ) const
25 {
26
27 #ifdef BUC61044
28   Graphic3d_CView MyCView = view;
29   call_togl_depthtest( &MyCView, isEnabled );
30 #endif
31
32 }
33
34 Standard_Boolean OpenGl_GraphicDriver
35 ::IsDepthTestEnabled( const Graphic3d_CView& view ) const
36 {
37 #ifdef BUC61044
38   Graphic3d_CView MyCView = view;
39   if ( call_togl_isdepthtest( &MyCView ) )
40     return Standard_True;
41 #endif
42 }
43
44 void OpenGl_GraphicDriver::ReadDepths( const Graphic3d_CView& view,
45                                        const Standard_Integer x,
46                                        const Standard_Integer y,
47                                        const Standard_Integer width,
48                                        const Standard_Integer height,
49                                        const Standard_Address buffer ) const
50 {
51   TelReadDepths (view.WsId, x, y, width, height, (float*) buffer);
52 }
53
54 void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& view,
55                                              const Standard_Boolean isEnabled ) const
56 {
57 #ifdef BUC61045
58   Graphic3d_CView MyCView = view;
59   call_togl_gllight( &MyCView, isEnabled );
60 #endif
61 }
62
63 Standard_Boolean OpenGl_GraphicDriver
64 ::IsGLLightEnabled( const Graphic3d_CView& view ) const
65 {
66 #ifdef BUC61045
67   Graphic3d_CView MyCView = view;
68   if ( call_togl_isgllight( &MyCView ) )
69     return Standard_True;
70 #endif
71 }
72
73 void OpenGl_GraphicDriver :: PrimitiveArray( const Graphic3d_CGroup& ACGroup,
74                                              const Graphic3d_PrimitiveArray& parray,
75                                                  const Standard_Boolean EvalMinMax )
76 {
77   Graphic3d_CGroup MyCGroup = ACGroup;
78
79   if( parray ) call_togl_parray (&MyCGroup,parray);
80 }
81
82
83 void OpenGl_GraphicDriver :: UserDraw ( const Graphic3d_CGroup& ACGroup,
84                                         const Graphic3d_CUserDraw& AUserDraw )
85 {
86   Graphic3d_CGroup MyCGroup = ACGroup;
87   Graphic3d_CUserDraw MyUserDraw = AUserDraw;
88
89   call_togl_userdraw (&MyCGroup,&MyUserDraw);
90 }
91
92 extern int VBOenabled;
93
94 void OpenGl_GraphicDriver :: EnableVBO( const Standard_Boolean flag )
95 {
96   VBOenabled = flag;
97 }