summaryrefslogtreecommitdiff
path: root/src/OpenGl/OpenGl_GraphicDriver_713.cxx
blob: a61d15520aa93cee42fa64f6005bffd4b74995c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// File         OpenGl_GraphicDriver_713.cxx
// Created      22-10-01
// Author       SAV

// SAV 09/07/02 merged with OpenGl_GraphicDriver_713.cxx created 16/06/2000 by ATS,SPK,GG : G005
//              implementation of PARRAY method

#include <OpenGl_GraphicDriver.jxx>

#include <Aspect_DriverDefinitionError.hxx>


#include <OpenGl_tgl_funcs.hxx>
#include <OpenGl_telem_util.hxx>


#define  BUC61044    /* 25/10/01 SAV ; added functionality to control gl depth testing
from higher API */
#define  BUC61045    /* 25/10/01 SAV ; added functionality to control gl lighting 
from higher API */


void OpenGl_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView& view,
                                               const Standard_Boolean isEnabled ) const
{

#ifdef BUC61044
  Graphic3d_CView MyCView = view;
  call_togl_depthtest( &MyCView, isEnabled );
#endif

}

Standard_Boolean OpenGl_GraphicDriver
::IsDepthTestEnabled( const Graphic3d_CView& view ) const
{
#ifdef BUC61044
  Graphic3d_CView MyCView = view;
  return call_togl_isdepthtest (&MyCView) != 0;
#endif
  return Standard_True;
}

void OpenGl_GraphicDriver::ReadDepths( const Graphic3d_CView& view,
                                       const Standard_Integer x,
                                       const Standard_Integer y,
                                       const Standard_Integer width,
                                       const Standard_Integer height,
                                       const Standard_Address buffer ) const
{
  TelReadDepths (view.WsId, x, y, width, height, (float*) buffer);
}

void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& view,
                                             const Standard_Boolean isEnabled ) const
{
#ifdef BUC61045
  Graphic3d_CView MyCView = view;
  call_togl_gllight( &MyCView, isEnabled );
#endif
}

Standard_Boolean OpenGl_GraphicDriver
::IsGLLightEnabled( const Graphic3d_CView& view ) const
{
#ifdef BUC61045
  Graphic3d_CView MyCView = view;
  return call_togl_isgllight (&MyCView) != 0;
#endif
  return Standard_True;
}

void OpenGl_GraphicDriver :: PrimitiveArray( const Graphic3d_CGroup& ACGroup,
                                             const Graphic3d_PrimitiveArray& parray,
                                                 const Standard_Boolean EvalMinMax )
{
  Graphic3d_CGroup MyCGroup = ACGroup;

  if( parray ) call_togl_parray (&MyCGroup,parray);
}

//=======================================================================
//function : RemovePrimitiveArray
//purpose  : Purpose: Clear visualization data in graphical driver and
//           stop displaying the primitives array of the graphical group
//           <theCGroup>. This method is internal and should be used by
//           Graphic3d_Group only.
//=======================================================================

void OpenGl_GraphicDriver::RemovePrimitiveArray (const Graphic3d_CGroup&         theCGroup,
                                                 const Graphic3d_PrimitiveArray& thePArray)
{
  Graphic3d_CGroup MyCGroup = theCGroup;
  if (thePArray != NULL) call_togl_parray_remove (&MyCGroup, thePArray);
}

void OpenGl_GraphicDriver :: UserDraw ( const Graphic3d_CGroup& ACGroup,
                                        const Graphic3d_CUserDraw& AUserDraw )
{
  Graphic3d_CGroup MyCGroup = ACGroup;
  Graphic3d_CUserDraw MyUserDraw = AUserDraw;

  call_togl_userdraw (&MyCGroup,&MyUserDraw);
}

extern int VBOenabled;

void OpenGl_GraphicDriver :: EnableVBO( const Standard_Boolean flag )
{
  VBOenabled = flag;
}