View Full Version : 2D polygon wont display properly
12-07-2004, 12:59 PM
Im drawing a simple 2d polygon shaped like this |_| but upside down:
glEnd();except one of the straight vertices is displaying at an angle and not rendering properly, it doesnt make any sense! can anyone see what the problem might be?
12-07-2004, 01:19 PM
What poly do you want to draw ?
If it's a square you should code it like that:
glLoadIdentity(); // clean matrix
glColor3f(r.rf, g.gf, b.bf); // color ?
glTranslatef(x.xf, y.yf, z.zf); //position in 3d space
glEnd(); Check the GL^RedBook out :)
hope that helps
12-07-2004, 01:22 PM
Im trying to draw an odd shaped polygon, like this but upside down |_|
It animates one of the straight lines at a diagonal angle for some reason, I cant figure out why though.
Maybe a U shape just isnt valid with GL_POLYGON :confused:
12-07-2004, 02:14 PM
You're trying to draw a concave polygon that's why it's not coming out right.
OpenGL doesn't handle concave polygons only convex ones.
break your polygon into 3 polygons (the right side, the bar across the top and the left side) and render it as 3 quads.
12-07-2004, 02:37 PM
ah hah! thank you very much. atleast I got 1 thing right, opengl cant handle a U shape on its own
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.