0022962: Invalid realization of reading and writing material in STEP.
[occt.git] / src / OpenGl / OpenGl_togl_project_raster.cxx
1 /***********************************************************************
2
3 FONCTION :
4 ----------
5 File OpenGl_togl_project_raster :
6
7
8 REMARQUES:
9 ---------- 
10
11
12 HISTORIQUE DES MODIFICATIONS   :
13 --------------------------------
14 24-05-96 : CAL ; Creation
15 12-06-98 : CAL ; Modification respecter l'origine top-left.
16
17 ************************************************************************/
18
19 /*----------------------------------------------------------------------*/
20 /*
21 * Includes
22 */
23 #include <OpenGl_tgl_all.hxx>
24 #include <OpenGl_telem_util.hxx>
25 #include <OpenGl_cmn_varargs.hxx>
26 #include <OpenGl_tsm_ws.hxx>
27
28 //For right copution of projection befor dumping to pixmap
29 int call_togl_adopt_to_rect( int wsid, int width, int height ) {
30   CMN_KEY_DATA key;
31   TStatus result;
32
33   key.ldata = width;
34   result = TsmSetWSAttri (wsid, WSWidth, &key);
35   if (result != TSuccess)
36     return 1;
37
38   key.ldata = height;
39   result = TsmSetWSAttri (wsid, WSHeight, &key);
40   if (result != TSuccess)
41     return 1;
42
43   return 0;
44 }
45
46 int call_togl_project_raster
47 (
48  int wsid,
49  float x,
50  float y,
51  float z,
52  int *ixr,
53  int *iyr
54  )
55 {
56   TStatus result;
57   float xr, yr;
58
59   Tint h;
60   CMN_KEY_DATA key;
61
62   TsmGetWSAttri (wsid, WSHeight, &key);
63   h = key.ldata;
64
65   result = TelProjectionRaster (wsid, x, y, z, &xr, &yr);
66
67   if (result == TSuccess) {
68     *ixr = (int) xr;
69     *iyr = h - (int) yr;
70     return (0);
71   }
72   else
73     return (1);
74 }