summaryrefslogtreecommitdiff
path: root/src/OpenGl/OpenGl_GraphicDriver_707.cxx
blob: 365e29f9adbd9b72cdfd7636df48cedcb1d8ab4e (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

// File   OpenGl_GraphicDriver_707.cxx
// Created  Mardi 28 janvier 1997
// Author CAL

//-Copyright  MatraDatavision 1997

//-Version  

//-Design Declaration des variables specifiques aux Drivers

//-Warning  Un driver encapsule les Pex et OpenGl drivers

//-References 

//-Language C++ 2.0

//-Declarations

// for the class
#include <OpenGl_GraphicDriver.jxx>

#include <Aspect_DriverDefinitionError.hxx>

#include <OpenGl_tgl_funcs.hxx>

//-Aliases

//-Global data definitions

//-Methods, in order

void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup,
                                     const Graphic3d_Array1OfVertex& ListVertex,
                                     const Standard_Boolean ) 
{

  Graphic3d_CGroup MyCGroup = ACGroup;

  Standard_Integer i;
  Standard_Integer Lower  = ListVertex.Lower ();

  CALL_DEF_LISTPOINTS alpoints;

  i = ListVertex.Length ();

  alpoints.NbPoints = int (i);
  alpoints.TypePoints = 1;
  alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);

  if (MyTraceLevel) {
    PrintFunction ("call_togl_polyline");
    PrintCGroup (MyCGroup, 1);
  }
  call_togl_polyline (&MyCGroup, &alpoints);

}

void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup,
                                     const Graphic3d_Array1OfVertexC& ListVertex,
                                     const Standard_Boolean ) 
{

  Graphic3d_CGroup MyCGroup = ACGroup;


  Standard_Real X, Y, Z;
  Standard_Real R, G, B;

  Standard_Integer i, j;
  Standard_Integer Lower  = ListVertex.Lower ();
  Standard_Integer Upper  = ListVertex.Upper ();

  CALL_DEF_LISTPOINTS alpoints;
  CALL_DEF_POINTC *points;

  i = ListVertex.Length ();

  // Allocation dynamique
  points  = new CALL_DEF_POINTC [i];

  alpoints.NbPoints = int (i);
  alpoints.TypePoints = 3;
  alpoints.UPoints.PointsC= points;

  Lower = ListVertex.Lower ();
  Upper = ListVertex.Upper ();

  // Parcours des sommets
  for (j=0, i=Lower; i<=Upper; i++, j++) {
    ListVertex (i).Coord (X, Y, Z);
    (ListVertex (i).Color ()).Values (R, G, B, Quantity_TOC_RGB);
    points[j].Color.r = float (R);
    points[j].Color.g = float (G);
    points[j].Color.b = float (B);
    points[j].Point.x = float (X);
    points[j].Point.y = float (Y);
    points[j].Point.z = float (Z);
  }

  if (MyTraceLevel) {
    PrintFunction ("call_togl_polyline");
    PrintCGroup (MyCGroup, 1);
  }
  call_togl_polyline (&MyCGroup, &alpoints);

  // Desallocation dynamique
  delete [] points;

}

void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup,
                                     const Standard_Real X1,
                                     const Standard_Real Y1,
                                     const Standard_Real Z1,
                                     const Standard_Real X2,
                                     const Standard_Real Y2,
                                     const Standard_Real Z2,
                                     const Standard_Boolean )
{

  Graphic3d_CGroup TheGroup = ACGroup;

  CALL_DEF_LISTPOINTS alpoints;

  CALL_DEF_POINT *points;

  // Allocation dynamique
  points  = new CALL_DEF_POINT [2];

  alpoints.NbPoints = 2;
  alpoints.TypePoints = 1;
  alpoints.UPoints.Points = points;

  points[0].x = float (X1);
  points[0].y = float (Y1);
  points[0].z = float (Z1);
  points[1].x = float (X2);
  points[1].y = float (Y2);
  points[1].z = float (Z2);

  call_togl_polyline (&TheGroup, &alpoints);

  // Desallocation dynamique
  delete [] points;

}