0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_togl_begin.cxx
CommitLineData
7fd59977 1/***********************************************************************
2
3FONCTION :
4----------
5file OpenGl_togl_begin.c :
6
7
8REMARQUES:
9----------
10
11
12HISTORIQUE DES MODIFICATIONS :
13--------------------------------
14xx-xx-xx : CAL ; Creation.
1521-01-97 : CAL : Ajout temporaire d'un XSynchronize pour
16eviter un SEG V lors de la destruction d'une vue.
1705-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
1825-03-97 : CAL : getenv de CSF_GraphicSync
1904-11-97 : FMN : ajout InitExtensionGLX();
2017-03-98 : FMN ; Ajout mode animation
2124-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide)
2222-12-98 : FMN ; Rename CSF_WALKTHROW en CSF_WALKTHROUGH
2308/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
52EXPORT GLboolean env_walkthrow = GL_FALSE;
53/* OCC18942: The new symmetric perspective projection matrix is off by default */
54EXPORT GLboolean env_sym_perspective = GL_FALSE;
55
56/*----------------------------------------------------------------------*/
57/*
58
59Opens and initialises Graphic Library environment.
60Returns true if the Graphic Library environment is open.
61Returns false if the Graphic Library environment is closed (error).
62
63*/
64
65int EXPORT
66call_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
104Sets the Graphic Library environment.
105Returns true if the Graphic Library environment is open.
106Returns false if the Graphic Library environment is closed (error).
107
108
109*/
110
111int EXPORT
112call_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*/