| 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 | return call_togl_isdepthtest (&MyCView) != 0; |
| 40 | #endif |
| 41 | } |
| 42 | |
| 43 | void OpenGl_GraphicDriver::ReadDepths( const Graphic3d_CView& view, |
| 44 | const Standard_Integer x, |
| 45 | const Standard_Integer y, |
| 46 | const Standard_Integer width, |
| 47 | const Standard_Integer height, |
| 48 | const Standard_Address buffer ) const |
| 49 | { |
| 50 | TelReadDepths (view.WsId, x, y, width, height, (float*) buffer); |
| 51 | } |
| 52 | |
| 53 | void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& view, |
| 54 | const Standard_Boolean isEnabled ) const |
| 55 | { |
| 56 | #ifdef BUC61045 |
| 57 | Graphic3d_CView MyCView = view; |
| 58 | call_togl_gllight( &MyCView, isEnabled ); |
| 59 | #endif |
| 60 | } |
| 61 | |
| 62 | Standard_Boolean OpenGl_GraphicDriver |
| 63 | ::IsGLLightEnabled( const Graphic3d_CView& view ) const |
| 64 | { |
| 65 | #ifdef BUC61045 |
| 66 | Graphic3d_CView MyCView = view; |
| 67 | return call_togl_isgllight (&MyCView) != 0; |
| 68 | #endif |
| 69 | } |
| 70 | |
| 71 | void OpenGl_GraphicDriver :: PrimitiveArray( const Graphic3d_CGroup& ACGroup, |
| 72 | const Graphic3d_PrimitiveArray& parray, |
| 73 | const Standard_Boolean EvalMinMax ) |
| 74 | { |
| 75 | Graphic3d_CGroup MyCGroup = ACGroup; |
| 76 | |
| 77 | if( parray ) call_togl_parray (&MyCGroup,parray); |
| 78 | } |
| 79 | |
| 80 | //======================================================================= |
| 81 | //function : RemovePrimitiveArray |
| 82 | //purpose : Purpose: Clear visualization data in graphical driver and |
| 83 | // stop displaying the primitives array of the graphical group |
| 84 | // <theCGroup>. This method is internal and should be used by |
| 85 | // Graphic3d_Group only. |
| 86 | //======================================================================= |
| 87 | |
| 88 | void OpenGl_GraphicDriver::RemovePrimitiveArray (const Graphic3d_CGroup& theCGroup, |
| 89 | const Graphic3d_PrimitiveArray& thePArray) |
| 90 | { |
| 91 | Graphic3d_CGroup MyCGroup = theCGroup; |
| 92 | if (thePArray != NULL) call_togl_parray_remove (&MyCGroup, thePArray); |
| 93 | } |
| 94 | |
| 95 | void OpenGl_GraphicDriver :: UserDraw ( const Graphic3d_CGroup& ACGroup, |
| 96 | const Graphic3d_CUserDraw& AUserDraw ) |
| 97 | { |
| 98 | Graphic3d_CGroup MyCGroup = ACGroup; |
| 99 | Graphic3d_CUserDraw MyUserDraw = AUserDraw; |
| 100 | |
| 101 | call_togl_userdraw (&MyCGroup,&MyUserDraw); |
| 102 | } |
| 103 | |
| 104 | extern int VBOenabled; |
| 105 | |
| 106 | void OpenGl_GraphicDriver :: EnableVBO( const Standard_Boolean flag ) |
| 107 | { |
| 108 | VBOenabled = flag; |
| 109 | } |