Code_TYMPAN  4.4.0
Industrial site acoustic simulation
OGLRectangle.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 /*
17  *
18  */
19 
20 #include "OGLRectangle.h"
21 
22 #if _WIN32
23  #include <windows.h>
24 #endif //_WIN32
25 
26 #include <GL/gl.h>
27 
28 #include "Tympan/core/color.h"
30 
32 
34 
35 void OGLRectangle::drawRectangle(const OPoint3D& point0, const OPoint3D& point1, const OPoint3D& point2,
36  const OPoint3D& point3, const OColor& oColor, bool bFull /*=false*/) const
37 {
38  float tmpColor[4];
39  glGetFloatv(GL_CURRENT_COLOR, tmpColor);
40  // Couleur de la ligne
41  glColor3fv(oColor);
42 
43  // On dessine
44  if (bFull)
45  {
46  glBegin(GL_QUADS);
47  }
48  else
49  {
50  glBegin(GL_LINES);
51  }
52  // Top Left --> Top Right
53  glVertex3d(point0._x, point0._y, point0._z);
54  glVertex3d(point1._x, point1._y, point1._z);
55 
56  // Top Right --> Bottom Right
57  glVertex3d(point1._x, point1._y, point1._z);
58  glVertex3d(point2._x, point2._y, point2._z);
59 
60  // Bottom Right --> Bottom Left
61  glVertex3d(point2._x, point2._y, point2._z);
62  glVertex3d(point3._x, point3._y, point3._z);
63 
64  // Bottom Left --> Top Left
65  glVertex3d(point3._x, point3._y, point3._z);
66  glVertex3d(point0._x, point0._y, point0._z);
67  // Fin
68  glEnd();
69  glColor3f(tmpColor[0], tmpColor[1], tmpColor[2]);
70 }
All base classes related to 3D manipulation.
Definition: color.h:31
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
void drawRectangle(const OPoint3D &point0, const OPoint3D &point1, const OPoint3D &point2, const OPoint3D &point3, const OColor &oColor, bool bFalse=false) const
virtual ~OGLRectangle()
The 3D point class.
Definition: 3d.h:487