Sign in to follow this  
lildragon555

Can't render quads

Recommended Posts

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

[code]//Top
glBegin(GL_QUADS);
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();
[/code]

Share this post


Link to post
Share on other sites
bluntman    255
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.

Share this post


Link to post
Share on other sites
lildragon555    100
[quote name='bluntman' timestamp='1305927623' post='4813650']
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.
[/quote]

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

Share this post


Link to post
Share on other sites
Brother Bob    10344
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.

Share this post


Link to post
Share on other sites
lildragon555    100
[quote name='Brother Bob' timestamp='1305933281' post='4813680']
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.
[/quote]

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this