iDevGames Forums
Trying to make a square... there's a triangle! - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Trying to make a square... there's a triangle! (/thread-1205.html)



Trying to make a square... there's a triangle! - TimMcD - Jun 2, 2009 02:14 PM

glBegin(GL_QUADS);
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?


Trying to make a square... there's a triangle! - TimMcD - Jun 2, 2009 02:18 PM

Meh, the ascii art got trashed... ._.

--------
------/ supposed to look like this,
------\ Little triangle out of the side!
--------


Trying to make a square... there's a triangle! - Najdorf - Jun 2, 2009 02:18 PM

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);


Trying to make a square... there's a triangle! - TimMcD - Jun 2, 2009 02:29 PM

Ah, thanks. Would it be smarter to just use a 'glutSoliderCube()'?


Trying to make a square... there's a triangle! - AnotherJake - Jun 2, 2009 03:41 PM

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.