glBegin(GL_POLYGON);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f( test[0][0][0], test[0][0][0], test[0][0][0]);
glVertex3f( test[0][0][1], test[0][1][0], test[1][0][0]);
glVertex3f( test[0][0][2], test[0][2][0], test[2][0][0]);
glEnd();
show array as polygon?
i''m sitting here and trying to show my array named test[3][3][3]
as polygons...
i tried this but it doesn''t work
glVertex3f(test[0][0][0], test[0][0][1], test[0][0][2]);
glVertex3f(test[0][1][0], test[0][1][1], test[0][1][2]);
glVertex3f(test[0][2][0], test[0][2][1], test[0][2][2]);
maybe...
glVertex3f(test[0][1][0], test[0][1][1], test[0][1][2]);
glVertex3f(test[0][2][0], test[0][2][1], test[0][2][2]);
maybe...
December 16, 2003 04:58 PM
You must call glBegin(GL_POLYGONS) (plural) not glBegin(GL_POLYGON)
quote:
Original post by Anonymous Poster
You must call glBegin(GL_POLYGONS) (plural) not glBegin(GL_POLYGON)
no..
quote:
Platform SDK: OpenGL:
...
void glBegin(
GLenum mode
);
...
Parameters
mode
..
GL_POLYGON
Draws a single, convex polygon. Vertices 1 through N define this polygon.
yeah.
you might have culling enabled. try drawing the polygon in different winding. (swap 2 last glvertex calls)
or it simply may not be on screen. This is most likly.
[edited by - RipTorn on December 17, 2003 10:17:35 PM]
It seems like there is more than one way to display a polygon in a 3x3x3 array, but the way you are doing it will make a triangle with a few of the values from your array as vertex points, as you only have 3 calls to glVertex3f.
The way POLYGON mode works is that you specify the initial vertex, and then a line is drawn to the next vertex specified, and so on until the last vertex is specified, when a line is drawn back to the first vertex. (Note: it doesn''t actually draw these lines, I saw draw as in drawing a mental picture of what the polygon would look like).
If you want more than one polygon, you are going to have to change the code a little to use a for loop perhaps or another GL primitive that I am forgetting about. If you are only interested in making triangles, you can use the TRIANGLES mode to draw a bunch of triangles (where every 3 vertices specifies one triangle).
The way POLYGON mode works is that you specify the initial vertex, and then a line is drawn to the next vertex specified, and so on until the last vertex is specified, when a line is drawn back to the first vertex. (Note: it doesn''t actually draw these lines, I saw draw as in drawing a mental picture of what the polygon would look like).
If you want more than one polygon, you are going to have to change the code a little to use a for loop perhaps or another GL primitive that I am forgetting about. If you are only interested in making triangles, you can use the TRIANGLES mode to draw a bunch of triangles (where every 3 vertices specifies one triangle).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement