Code_TYMPAN  4.4.0
Industrial site acoustic simulation
OGLGridElement.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 "OGLGridElement.h"
21 
22 #if _WIN32
23  #include <windows.h>
24 #endif //_WIN32
25 
26 #include <GL/gl.h>
27 
28 #include "OGLGrid.h"
30 
32 {
34  m_fGridDimX = .0;
35  m_fGridDimY = .0;
36  m_fGridStep = .0;
37  m_bIs3D = false;
38  m_bShowGridXY = false;
39  m_bShowGridXZ = false;
40  m_bShowGridZY = false;
41 }
42 
44 {
46  {
47  delete m_pOGLGridToDisplay;
48  }
49 }
50 
51 void OGLGridElement::setColor(const OColor& oColor)
52 {
53  m_oColor = oColor;
54 }
55 
57 {
58  if (m_bVisible)
59  {
60  if (m_bIs3D)
61  {
62  // Nouvelle vue
63  glMatrixMode(GL_MODELVIEW);
64  glPushMatrix();
67  // Ancienne vue
68  glPopMatrix();
69  }
70  else
71  {
72  // Nouvelle projection
73  glMatrixMode(GL_PROJECTION);
74  glPushMatrix();
75  glLoadIdentity();
76  unsigned int width = OSizeManager::get()->getWidth();
77  unsigned int height = OSizeManager::get()->getHeight();
78  glOrtho(0, width, 0.0, height, 0.0, 1.0);
79 
80  // Nouvelle vue
81  glMatrixMode(GL_MODELVIEW);
82  glPushMatrix();
83  glLoadIdentity();
84 
87 
88  // Ancienne projection
89  glMatrixMode(GL_PROJECTION);
90  glPopMatrix();
91 
92  // Ancienne vue
93  glMatrixMode(GL_MODELVIEW);
94  glPopMatrix();
95  }
96  }
97 
98  return 0;
99 }
Definition: color.h:31
bool m_bVisible
Definition: OGLElement.h:76
bool m_bIs3D
Definition: OGLElement.h:77
virtual ~OGLGridElement()
virtual int render()
void setColor(const OColor &oColor)
OGLGrid * m_pOGLGridToDisplay
void drawGrid(const float gridDimX, const float gridDimY, const float gridStep, const OColor &oColor, bool bShowGridXY, bool showGridXZ, bool showGridZY) const
Definition: OGLGrid.cpp:36
static LPOSizeManager get()