33 #define STDCALL __stdcall
74 glTexCoord2dv(vertex + 3);
79 const unsigned char* sError = gluErrorString(errorCode);
80 printf(
"Erreur OpenGL %d : %s\n", errorCode, sError);
87 size_t nbPts = getElement()->getNbPts();
88 for (
size_t i = 0; i < nbPts; i++)
90 OPoint3D pt = getElement()->getPoint(i);
98 size_t nbPts = getElement()->getNbPts();
103 glGetFloatv(GL_CURRENT_COLOR, color);
108 glColor3f(color[0], color[1], color[2]);
118 double xSize = 0, ySize = 0;
129 glBegin(GL_TRIANGLES);
131 OPoint3D pt1 = getElement()->getPoint(0);
132 OPoint3D pt2 = getElement()->getPoint(1);
133 OPoint3D pt3 = getElement()->getPoint(2);
136 glNormal3f(normal.
_x, normal.
_y, normal.
_z);
139 double x = pt.
_x - topLeftTexture.
_x;
140 double y = pt.
_y - topLeftTexture.
_y;
141 if ((x >= 0) && (y >= 0))
143 glTexCoord2f(x / xSize, y / ySize);
154 glVertex3f(pt.
_x, pt.
_y, pt.
_z);
159 double x = pt.
_x - topLeftTexture.
_x;
160 double y = pt.
_y - topLeftTexture.
_y;
161 if ((x >= 0) && (y >= 0))
163 glTexCoord2f(x / xSize, y / ySize);
174 glVertex3f(pt.
_x, pt.
_y, pt.
_z);
179 double x = pt.
_x - topLeftTexture.
_x;
180 double y = pt.
_y - topLeftTexture.
_y;
181 if ((x >= 0) && (y >= 0))
183 glTexCoord2f(x / xSize, y / ySize);
194 glVertex3f(pt.
_x, pt.
_y, pt.
_z);
200 OPoint3D p1 = getElement()->getCenter();
208 double(*vertex)[5] =
new double[nbPts][5];
224 const TYTabPoint* pts = &(getElement()->getPoints());
229 TYRectangle rect = getElement()->getBoundingRect();
233 double minX = NAN, minY = NAN;
240 for (
size_t i = 0; i < nbPts; i++)
243 vertex[i][0] = (*pts)[i]._x;
244 vertex[i][1] = (*pts)[i]._y;
245 vertex[i][2] = (*pts)[i]._z;
248 vertex[i][3] = (vertex[i][0] - minX) / scale;
249 vertex[i][4] = (vertex[i][1] - minY) / scale;
251 gluTessVertex(
_gLUtesselator, (GLdouble*)(*pts)[i]._value, (GLdouble*)vertex[i]);
258 OPoint3D p1 = getElement()->getCenter();
273 for (
int i = 0; i < 3; i++)
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
void STDCALL endCallback()
void STDCALL vertexCallback(GLdouble *vertex)
void errorCallback(GLenum errorCode)
void STDCALL beginCallback(GLenum which)
Representation graphique d'un polygone (fichier header)
Contexte de rendu utilisé par les fonctions d'affichage.
@ Overlay
The current render pass is for overlay elements.
virtual void Enlarge(const OPoint3D &pt)
Enlarge the box with the point if the point is outside the box.
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
OVector3D normal(const OVector3D &vector2, const OVector3D &vector3) const
Computes the normal with this vector and 2 others.
void normalize()
Normalizes this vector.
classe graphique pour un element de base
void drawName(TYRenderContext &renderContext)
bool _visible
Inique si l'element est visible.
static bool _gDrawNormals
Indique si les normals doivent etre visible.
bool _texture
Indique si le texturing est active pour cet element.
bool _highlight
Indique si le highlight est active pour cet element.
void displayNormal(OVector3D normal, OPoint3D p1)
virtual void update(bool force=false)
void enable(bool enable)
Active la generation de nom.
static TYNameManager * get()
Retourne l'instance singleton.
GLUtesselator * _gLUtesselator
virtual ~TYPolygonGraphic()
virtual OBox computeBoundingBox() const
void setAltimetrieColor(double color0[3], double color1[3], double color2[3])
double _color0[3]
Pour les polygones de l'altimetrie chaque sommet a une couleur differente.
virtual void update(bool force=false)
bool _altimetrie
Indique si ce polygone fait partie de l'altimetrie.
TYPolygonGraphic(TYPolygon *pElement)
virtual void display(TYRenderContext &renderContext)