0022962: Invalid realization of reading and writing material in STEP.
[occt.git] / src / OpenGl / OpenGl_togl_begin.cxx
1 /***********************************************************************
2
3 FONCTION :
4 ----------
5 file OpenGl_togl_begin.c :
6
7
8 REMARQUES:
9 ---------- 
10
11
12 HISTORIQUE DES MODIFICATIONS   :
13 --------------------------------
14 xx-xx-xx : CAL ; Creation.
15 21-01-97 : CAL : Ajout temporaire d'un XSynchronize pour
16 eviter un SEG V lors de la destruction d'une vue.
17 05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
18 25-03-97 : CAL : getenv de CSF_GraphicSync
19 04-11-97 : FMN : ajout InitExtensionGLX();
20 17-03-98 : FMN ; Ajout mode animation
21 24-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide)
22 22-12-98 : FMN ; Rename CSF_WALKTHROW en CSF_WALKTHROUGH
23 08/04/02 : GG ; RIC120302 Add call_togl_begin_display() function
24
25 ************************************************************************/
26
27 #define G003  /* GG 25-01-00 Enable animation always ...
28 //    See V3d_View::SetAnimationMode()
29 */
30
31 /*----------------------------------------------------------------------*/
32 /*
33 * Includes
34 */
35
36 #include <stdlib.h>
37
38 #include <OpenGl_tgl_all.hxx>
39 #include <InterfaceGraphic_Graphic3d.hxx>
40 #include <InterfaceGraphic_Visual3d.hxx>
41 #include <OpenGl_tgl.hxx>
42 #include <OpenGl_tgl_tox.hxx>
43 #include <OpenGl_tgl_funcs.hxx>
44 #include <OpenGl_Extension.hxx>
45 #include <OpenGl_animation.hxx>
46
47 /*----------------------------------------------------------------------*/
48 /*
49 * Variable globales
50 */
51
52 EXPORT GLboolean env_walkthrow = GL_FALSE;
53 /* OCC18942: The new symmetric perspective projection matrix is off by default */
54 EXPORT GLboolean env_sym_perspective = GL_FALSE;
55
56 /*----------------------------------------------------------------------*/
57 /*
58
59 Opens and initialises Graphic Library environment.
60 Returns true  if the Graphic Library environment is open.
61 Returns false if the Graphic Library environment is closed (error).
62
63 */
64
65 int EXPORT
66 call_togl_begin
67 (
68  char *adisplay
69  )
70 {
71   char *pvalue;
72
73   call_togl_set_environment (adisplay);
74 #ifndef WNT
75   if ((pvalue = getenv ("CSF_GraphicSync")) != NULL)
76     XSynchronize (call_thedisplay, 1);
77   InitExtensionGLX(call_thedisplay);
78 #endif
79
80   /* Test si mode workthrough oui/non */
81   if ((pvalue = getenv ("CSF_WALKTHROUGH")) != NULL)
82     env_walkthrow = GL_TRUE;
83
84   /* Activation/Desactivation du mode Animation */
85 #ifndef G003
86   if ((pvalue = getenv ("CALL_ANIMATION")) != NULL)
87     animationUseFlag = GL_TRUE;
88   else
89     animationUseFlag = GL_FALSE;
90 #endif
91
92   /* OCC18942: Test if symmetric perspective projection should be turned on */
93   if ((pvalue = getenv ("CSF_SYM_PERSPECTIVE")) != NULL)
94     env_sym_perspective = GL_TRUE;
95
96   call_togl_inquirefacilities ();
97   call_func_init_tgl ();
98   return (1);
99 }
100
101 /*RIC120302*/
102 /*
103
104 Sets the Graphic Library environment.
105 Returns true  if the Graphic Library environment is open.
106 Returns false if the Graphic Library environment is closed (error).
107
108
109 */
110
111 int EXPORT
112 call_togl_begin_display
113 (
114  void *pdisplay
115  )
116 {
117   char *pvalue = NULL;
118   int status;
119
120   status = call_tox_set_display (pdisplay);
121   if( status ) {
122 #ifndef WNT
123     if ((pvalue = getenv ("CSF_GraphicSync")) != NULL)
124       XSynchronize (call_thedisplay, 1);
125     InitExtensionGLX(call_thedisplay);
126 #endif
127     call_togl_inquirefacilities ();
128     call_func_init_tgl ();
129   }
130   return (status);
131 }
132 /*RIC120302*/