Trying to make a square... there's a triangle!

Member
Posts: 43
Joined: 2009.02
Post: #1
glVertex3f(-0.1, 0.1, 0.0);
glVertex3f(0.1, 0.1, 0.0);
glVertex3f(0.1, -0.1, 0.0);
glVertex3f(-0.1, -0.1, 0.0);
// ^^^ Front ^^^
// vvv Back vvv
glVertex3f(-0.1, 0.1, -0.1);
glVertex3f(0.1, 0.1, -0.1);
glVertex3f(0.1, -0.1, -0.1);
glVertex3f(-0.1, -0.1, -0.1);
// vvv Left vvv
glVertex3f(-0.1, 0.1, -0.1);
glVertex3f(-0.1, 0.1, 0.0);
glVertex3f(-0.1, -0.1, -0.1);
glVertex3f(-0.1, -0.1, 0.0);
glEnd();

The left side looks normal, theres a triangle in it, like:
-------
/
\
-------
Heh, thats not so good, but on one of the sides connecting the different 'Z' coordinates, theres a triangle chunk missing from the side! Any help?
Member
Posts: 43
Joined: 2009.02
Post: #2
Meh, the ascii art got trashed... ._.

--------
------/ supposed to look like this,
------\ Little triangle out of the side!
--------
Member
Posts: 749
Joined: 2003.01
Post: #3
left should be something like

glVertex3f(-0.1, 0.1, -0.1);
glVertex3f(-0.1, 0.1, 0.0);
glVertex3f(-0.1, -0.1, 0.0);
glVertex3f(-0.1, -0.1, -0.1);

Â©hâ‚¬ck Ã¸ut Âµy stuÆ’Æ’ Ã¥t ragdollsoft.com
Member
Posts: 43
Joined: 2009.02
Post: #4
Ah, thanks. Would it be smarter to just use a 'glutSoliderCube()'?
Moderator
Posts: 3,591
Joined: 2003.06
Post: #5
TimMcD Wrote:Ah, thanks. Would it be smarter to just use a 'glutSoliderCube()'?

Not if you want to ever use something besides GLUT, but otherwise, glutSolidCube is fine. Here's a little colored cube demo using GLUT, which I posted about a month ago.