Im drawing a simple 2d polygon shaped like this |_| but upside down:
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?
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
Check the GL^RedBook out
hope that helps
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
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.
ah hah! thank you very much. atleast I got 1 thing right, opengl cant handle a U shape on its own