summaryrefslogtreecommitdiff
path: root/src/OpenGl/OpenGl_tgl_utilgr.cxx
blob: 4c7a3f13c0727307300bb8290086c080a345e681 (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
/***********************************************************************

FONCTION :
----------
file OpenGl_tgl_utilgr :


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


HISTORIQUE DES MODIFICATIONS   :
--------------------------------
xx-xx-xx : xxx ; Creation.
29-04-96 : FMN ; Correction Warning.
30-01-97 : FMN ; Suppression call_util_init_indexes()
03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE

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

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


#include <OpenGl_tgl_all.hxx>

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include <InterfaceGraphic_Graphic3d.hxx>
#include <OpenGl_context.hxx>

#include <OpenGl_tgl_utilgr.hxx>
#include <OpenGl_Memory.hxx>

Tint
call_util_context_group_place( CALL_DEF_GROUP * agroup )
{
  Tint  n;

  n = 0;
  if( agroup->ContextLine.IsSet )
    n = n + CALL_DEF_CONTEXTLINE_SIZE;
  if( agroup->ContextFillArea.IsSet )
    n = n + CALL_DEF_CONTEXTFILLAREA_SIZE;
  if( agroup->ContextMarker.IsSet )
    n = n + CALL_DEF_CONTEXTMARKER_SIZE;
  if( agroup->ContextText.IsSet )
    n = n + CALL_DEF_CONTEXTTEXT_SIZE;

  return n;
}


Tint
call_util_osd_putenv( Tchar *symbol, Tchar *value )
{
#ifndef WNT
  Tchar   *s;
  Tint    l;

  l = strlen((char*)symbol) + strlen((char*)value) + 2;
  s = new Tchar[l];;
  if( s )
  {
    sprintf( (char*)s,"%s=%s", symbol, value );
    if( !putenv((char*)s) )
      return 1;
  }
  return 0;
#else
  return SetEnvironmentVariable ( (LPCSTR)symbol, (LPCSTR)value );
#endif  /* WNT */
}

Tint
call_util_rgbindex( Tfloat r, Tfloat g, Tfloat b )
{
  union
  {
    Tint      colpack;
    unsigned  char  rgb[3];
  } rgb2ind;

  rgb2ind.colpack = 0;
  rgb2ind.rgb[0] = ( unsigned char )(r*100);
  rgb2ind.rgb[1] = ( unsigned char )(g*100);
  rgb2ind.rgb[2] = ( unsigned char )(b*100);

  return rgb2ind.colpack;
}