• Create Account

Banner advertising on our site currently available from just \$5!

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

#1lildragon555  Members   -  Reputation: 100

Like
0Likes
Like

Posted 20 May 2011 - 03:26 PM

I attempted to create a simple box just placing points...but for some reason they come out as triangles instead of quads...
Any idea?

//Top
glVertex3f(0.0f, -4.0f, 0.0f);
glVertex3f(5.0f, -4.0f, 0.0f);
glVertex3f(0.0f, -4.0f, -5.0f);
glVertex3f(5.0f, -4.0f, -5.0f);

//Bottom
glVertex3f(0.0f, -2.0f, 0.0f);
glVertex3f(5.0f, -2.0f, 0.0f);
glVertex3f(0.0f, -2.0f, -5.0f);
glVertex3f(5.0f, -2.0f, -5.0f);

//Left Side
glVertex3f(0.0f, -4.0f, 0.0f);
glVertex3f(0.0f, -4.0f, -5.0f);
glVertex3f(0.0f, -2.0f, 0.0f);
glVertex3f(0.0f, -2.0f, -5.0f);

//Right Side
glVertex3f(5.0f, -4.0f, 0.0f);
glVertex3f(5.0f, -4.0f, -5.0f);
glVertex3f(5.0f, -2.0f, 0.0f);
glVertex3f(5.0f, -2.0f, -5.0f);

//Front Side
glVertex3f(0.0f, -4.0f, -5.0f);
glVertex3f(5.0f, -4.0f, -5.0f);
glVertex3f(0.0f, -2.0f, -5.0f);
glVertex3f(5.0f, -2.0f, -5.0f);

//Back Side
glVertex3f(0.0f, -4.0f, 0.0f);
glVertex3f(5.0f, -4.0f, 0.0f);
glVertex3f(0.0f, -2.0f, 0.0f);
glVertex3f(5.0f, -2.0f, 0.0f);
glEnd();


#2bluntman  Members   -  Reputation: 249

Like
0Likes
Like

Posted 20 May 2011 - 03:40 PM

All polygons are broken down into triangles before rasterization on the graphics card. So when you switch to wireframe rendering (which I am guessing is how you saw the triangles) you will see the edges of the finally rendered triangles. I believe there is a method to stop these from being rendered by flagging edges on your model for display.

#3lildragon555  Members   -  Reputation: 100

Like
0Likes
Like

Posted 20 May 2011 - 03:59 PM

All polygons are broken down into triangles before rasterization on the graphics card. So when you switch to wireframe rendering (which I am guessing is how you saw the triangles) you will see the edges of the finally rendered triangles. I believe there is a method to stop these from being rendered by flagging edges on your model for display.

No it isn't in wireframe mode...it's in fill mode...

#4Brother Bob  Moderators   -  Reputation: 9363

Like
1Likes
Like

Posted 20 May 2011 - 05:14 PM

The vertices of your all your quads are defined in a zig-zag order, like a Z, and not clockwise or counter-clockwise around the quad. The order of your vertices are very important. It should be enough to swap the order of the last two vertices of all quads to at least have the vertices define a proper quad. There may be other problems, such as inconsistent winding order and backface culling, that will break your cube.

#5lildragon555  Members   -  Reputation: 100

Like
0Likes
Like

Posted 20 May 2011 - 05:49 PM

The vertices of your all your quads are defined in a zig-zag order, like a Z, and not clockwise or counter-clockwise around the quad. The order of your vertices are very important. It should be enough to swap the order of the last two vertices of all quads to at least have the vertices define a proper quad. There may be other problems, such as inconsistent winding order and backface culling, that will break your cube.

Thanks man...didn't know the vertices had to be in order...

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS