View Full Version: how are objects drawn?

C++ Learning Community > OpenGL > how are objects drawn?


Title: how are objects drawn?
Description: this is kind of confusing me.


ih8censorship - July 26, 2005 03:17 AM (GMT)
why does this make a square
CODE
glBegin (GL_QUADS);
          glVertex2f (-0.1f, 0.1f);
          glVertex2f (0.1f, 0.1f);
          glVertex2f (0.1f, -0.1f);
          glVertex2f (-0.1f, -0.1f);
          glEnd ();    

and this just makes an odd looking quad
CODE
glBegin (GL_QUADS);
          glVertex2f (0.1f, -0.1f);
          glVertex2f (-0.1f, 0.1f);
          glVertex2f (0.1f, 0.1f);
          glVertex2f (-0.1f, -0.1f);
          glEnd ();    


all i can think of is it has to do with how OpenGL draws, more specificaly which directions or something... anyway its got me really confused and if it is because of how OGL draws id like to know the specifics of like which directions it draws and it what order or whatever.... i hope this makes sense to someone :wacko:

C-Man - July 26, 2005 07:25 AM (GMT)
just immagine you connecting the dots and you'll see why it is so

deadimp - November 24, 2005 05:02 AM (GMT)
3D is composed of triangles. If you don't have the right order for the triangles' coordinates, they could overlap each other instead of neighboring each other.
NeHe on GameDev.Net is an excellent resource.




* Hosted for free by InvisionFree