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

Member
Posts: 43
Joined: 2009.02
Post: #1
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?
Quote this message in a reply
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!
--------
Quote this message in a reply
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
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Member
Posts: 43
Joined: 2009.02
Post: #4
Ah, thanks. Would it be smarter to just use a 'glutSoliderCube()'?
Quote this message in a reply
Moderator
Posts: 3,572
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL ES : Dynamic calculation of triangle indices akademiks 0 4,130 Sep 13, 2011 07:58 AM
Last Post: akademiks
  Want good color interpolation for my square Najdorf 2 3,922 Nov 22, 2009 10:11 PM
Last Post: Najdorf
  texture no square surface kendric 7 4,426 Mar 20, 2009 05:26 PM
Last Post: kendric
  Triangle strip length imikedaman 6 5,690 Aug 6, 2006 05:32 PM
Last Post: NicholasFrancis
  Non-square, non-POT, hardware-accelerated surfaces... NekoYasha 13 5,732 Oct 25, 2005 03:06 PM
Last Post: NekoYasha