GL_QUADS Problem

This is a discussion on GL_QUADS Problem within the Game Programming forums, part of the General Programming Boards category; For some reason, whenever I try to make a quad with OpenGL, it always has a clear triangle in it. ...

  1. #1
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552

    GL_QUADS Problem

    For some reason, whenever I try to make a quad with OpenGL, it always has a clear triangle in it. I included a picture that show an example of it.
    Attached Images Attached Images  

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Code please.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    Code:
    void Render(void)
    {
    	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    	glPushMatrix();
    	glTranslatef(-1.0f, -1.0f, 0.0f);
    	glRotatef(SpinX, 1.0, 0.0, 0.0);
    	glRotatef(SpinY, 0.0, 1.0, 0.0);
    	glRotatef(SpinZ, 0.0, 0.0, 1.0);
    	glBegin(GL_TRIANGLES);
    		glColor3f(1.0f, 1.0f, 1.0f);
    		glVertex3f(0.0f, 0.0f, 0.0f);
    		glVertex3f(0.0f, 2.0f, 0.0f);
    		glVertex3f(2.0f, 0.0f, 0.0f);
    		glColor3f(1.0f, 0.0f, 0.0f);
    		glVertex3f(0.0f, 0.0f, 3.0f);
    		glVertex3f(0.0f, 2.0f, 3.0f);
    		glVertex3f(2.0f, 0.0f, 3.0f);
    	glEnd();
    	glBegin(GL_QUADS);
    		glColor3f(0.0f, 1.0f, 0.0f);
    		glVertex3f(0.0f, 0.0f, 0.0f);
    		glVertex3f(0.0f, 0.0f, 3.0f);
    		glVertex3f(2.0f, 0.0f, 0.0f);
    		glVertex3f(2.0f, 0.0f, 3.0f);
    	glEnd();
    	glPopMatrix();
    
    	glutSwapBuffers();
    }

  4. #4
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Just looking at that picture... it looks like a shadow.
    Away.

  5. #5
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    it's not, because if you rotate the image you can see right through it

  6. #6
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    you are drawing the vertices in the wrong order...

    Code:
    you are doing this...
    
    1----2
        /
       /
      /
    3----4
    
    you need to do this
    
    4--3
       |
       |
    1--2
    edit: ascii art
    Last edited by Perspective; 07-04-2003 at 11:53 PM.

  7. #7
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    I guess I should look up the order of vertices again

    thx

  8. #8
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    or turn off culling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21