summaryrefslogtreecommitdiff
path: root/src/OpenGl/OpenGl_togl_begin.cxx
blob: 1603fb673ee750539ee0c26ff611daae6d48d1d0 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/***********************************************************************

FONCTION :
----------
file OpenGl_togl_begin.c :


REMARQUES:
---------- 


HISTORIQUE DES MODIFICATIONS   :
--------------------------------
xx-xx-xx : CAL ; Creation.
21-01-97 : CAL : Ajout temporaire d'un XSynchronize pour
eviter un SEG V lors de la destruction d'une vue.
05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
25-03-97 : CAL : getenv de CSF_GraphicSync
04-11-97 : FMN : ajout InitExtensionGLX();
17-03-98 : FMN ; Ajout mode animation
24-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide)
22-12-98 : FMN ; Rename CSF_WALKTHROW en CSF_WALKTHROUGH
08/04/02 : GG ; RIC120302 Add call_togl_begin_display() function

************************************************************************/

#define G003  /* GG 25-01-00 Enable animation always ...
//    See V3d_View::SetAnimationMode()
*/

/*----------------------------------------------------------------------*/
/*
* Includes
*/

#include <stdlib.h>

#include <OpenGl_tgl_all.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
#include <OpenGl_tgl.hxx>
#include <OpenGl_tgl_tox.hxx>
#include <OpenGl_tgl_funcs.hxx>
#include <OpenGl_Extension.hxx>
#include <OpenGl_animation.hxx>

/*----------------------------------------------------------------------*/
/*
* Variable globales
*/

EXPORT GLboolean env_walkthrow = GL_FALSE;
/* OCC18942: The new symmetric perspective projection matrix is off by default */
EXPORT GLboolean env_sym_perspective = GL_FALSE;

/*----------------------------------------------------------------------*/
/*

Opens and initialises Graphic Library environment.
Returns true  if the Graphic Library environment is open.
Returns false if the Graphic Library environment is closed (error).

*/

int EXPORT
call_togl_begin
(
 char *adisplay
 )
{
  char *pvalue;

  call_togl_set_environment (adisplay);
#ifndef WNT
  if ((pvalue = getenv ("CSF_GraphicSync")) != NULL)
    XSynchronize (call_thedisplay, 1);
  InitExtensionGLX(call_thedisplay);
#endif

  /* Test si mode workthrough oui/non */
  if ((pvalue = getenv ("CSF_WALKTHROUGH")) != NULL)
    env_walkthrow = GL_TRUE;

  /* Activation/Desactivation du mode Animation */
#ifndef G003
  if ((pvalue = getenv ("CALL_ANIMATION")) != NULL)
    animationUseFlag = GL_TRUE;
  else
    animationUseFlag = GL_FALSE;
#endif

  /* OCC18942: Test if symmetric perspective projection should be turned on */
  if ((pvalue = getenv ("CSF_SYM_PERSPECTIVE")) != NULL)
    env_sym_perspective = GL_TRUE;

  call_togl_inquirefacilities ();
  call_func_init_tgl ();
  return (1);
}

/*RIC120302*/
/*

Sets the Graphic Library environment.
Returns true  if the Graphic Library environment is open.
Returns false if the Graphic Library environment is closed (error).


*/

int EXPORT
call_togl_begin_display
(
 void *pdisplay
 )
{
  int status;

  status = call_tox_set_display (pdisplay);
  if( status ) {
#ifndef WNT
    char *pvalue = NULL;
    if ((pvalue = getenv ("CSF_GraphicSync")) != NULL)
      XSynchronize (call_thedisplay, 1);
    InitExtensionGLX(call_thedisplay);
#endif
    call_togl_inquirefacilities ();
    call_func_init_tgl ();
  }
  return (status);
}
/*RIC120302*/