30 #define STDCALL __stdcall
71 glTexCoord2dv(vertex + 3);
76 const unsigned char* sError = gluErrorString(errorCode);
77 printf(
"Erreur OpenGL %d : %s\n", errorCode, sError);
85 size_t nbPts = getElement()->getNbPts();
86 for (
size_t i = 0; i < nbPts; i++)
88 OPoint3D pt = getElement()->getPoint(i);
95 size_t nbPts = getElement()->getNbPts();
100 glGetFloatv(GL_CURRENT_COLOR, color);
108 if (mode == GL_COMPILE)
112 glColor3f(color[0], color[1], color[2]);
122 double xSize = 0, ySize = 0;
133 glBegin(GL_TRIANGLES);
135 OPoint3D pt1 = getElement()->getPoint(0);
136 OPoint3D pt2 = getElement()->getPoint(1);
137 OPoint3D pt3 = getElement()->getPoint(2);
140 glNormal3f(normal.
_x, normal.
_y, normal.
_z);
143 double x = pt.
_x - topLeftTexture.
_x;
144 double y = pt.
_y - topLeftTexture.
_y;
145 if ((x >= 0) && (y >= 0))
147 glTexCoord2f(x / xSize, y / ySize);
158 glVertex3f(pt.
_x, pt.
_y, pt.
_z);
163 double x = pt.
_x - topLeftTexture.
_x;
164 double y = pt.
_y - topLeftTexture.
_y;
165 if ((x >= 0) && (y >= 0))
167 glTexCoord2f(x / xSize, y / ySize);
178 glVertex3f(pt.
_x, pt.
_y, pt.
_z);
183 double x = pt.
_x - topLeftTexture.
_x;
184 double y = pt.
_y - topLeftTexture.
_y;
185 if ((x >= 0) && (y >= 0))
187 glTexCoord2f(x / xSize, y / ySize);
198 glVertex3f(pt.
_x, pt.
_y, pt.
_z);
204 OPoint3D p1 = getElement()->getCenter();
212 double(*vertex)[5] =
new double[nbPts][5];
228 const TYTabPoint* pts = &(getElement()->getPoints());
233 TYRectangle rect = getElement()->getBoundingRect();
237 double minX = NAN, minY = NAN;
244 for (
size_t i = 0; i < nbPts; i++)
247 vertex[i][0] = (*pts)[i]._x;
248 vertex[i][1] = (*pts)[i]._y;
249 vertex[i][2] = (*pts)[i]._z;
252 vertex[i][3] = (vertex[i][0] - minX) / scale;
253 vertex[i][4] = (vertex[i][1] - minY) / scale;
255 gluTessVertex(
_gLUtesselator, (GLdouble*)(*pts)[i]._value, (GLdouble*)vertex[i]);
262 OPoint3D p1 = getElement()->getCenter();
280 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)
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(TYElement *pModelerElement=nullptr)
static OBox _globalBoundingBox
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 drawLineBoundingBox()
void enable(bool enable)
Active la generation de nom.
static TYNameManager * get()
Retourne l'instance singleton.
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
GLUtesselator * _gLUtesselator
virtual void computeBoundingBox()
virtual ~TYPolygonGraphic()
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)