the bottom is not drawn

Hi, i have a problem with a simple pyramide, the bottom is not drawn, the code is from the nehe tutorial (moreless). Does anybody know what is wrong?

public class TestRenderer implements GLEventListener{

         float      xrot;                        // X Rotation ( NEW )
      float      yrot;                        // Y Rotation ( NEW )
      float      zrot;
   
  public void init(GLDrawable glDrawable){
        final GL gl = glDrawable.getGL();
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.glShadeModel(GL.GL_SMOOTH);
        gl.glClearDepth(1.0);                      // Depth Buffer Setup
        gl.glEnable(GL.GL_DEPTH_TEST);                                          // Enables Depth Testing
        gl.glDepthFunc(GL.GL_LEQUAL);                                                // The Type Of Depth Testing To Do
        gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
       
      }
   
   public void displayChanged(GLDrawable gLDrawable, boolean modeChanged, boolean deviceChanged){
      }
  
   public void display(GLDrawable gLDrawable)
      {
        final GL gl = gLDrawable.getGL();
        
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
        gl.glLoadIdentity();
        
        gl.glTranslatef(-1.5f, 0.0f, -6.0f);
        gl.glRotatef(xrot,1.0f,0.0f,0.0f);
        gl.glRotatef(yrot,0.0f,1.0f,0.0f);
        gl.glRotatef(zrot,0.0f,0.0f,1.0f);
        
        gl.glBegin(GL.GL_POLYGON);                // Drawing Using Triangles
          gl.glColor3f(1.0f,0.0f,0.0f);                  // Red
          gl.glVertex3f( 0.0f, 1.0f, 0.0f);                  // Top Of Triangle (Front)
          gl.glColor3f(0.0f,1.0f,0.0f);                  // Green
          gl.glVertex3f(-1.0f,-1.0f, 1.0f);                  // Left Of Triangle (Front)
          gl.glColor3f(0.0f,0.0f,1.0f);                  // Blue
          gl.glVertex3f( 1.0f,-1.0f, 1.0f);                  // Right Of Triangle (Front)
          gl.glColor3f(1.0f,0.0f,0.0f);                  // Red
          gl.glVertex3f( 0.0f, 1.0f, 0.0f);                  // Top Of Triangle (Right)
          gl.glColor3f(0.0f,0.0f,1.0f);                  // Blue
          gl.glVertex3f( 1.0f,-1.0f, 1.0f);                  // Left Of Triangle (Right)
          gl.glColor3f(0.0f,1.0f,0.0f);                  // Green
          gl.glVertex3f( 1.0f,-1.0f, -1.0f);                  // Right Of Triangle (Right)
          gl.glColor3f(1.0f,0.0f,0.0f);                  // Red
          gl.glVertex3f( 0.0f, 1.0f, 0.0f);                  // Top Of Triangle (Back)
          gl.glColor3f(0.0f,1.0f,0.0f);                  // Green
          gl.glVertex3f( 1.0f,-1.0f, -1.0f);                  // Left Of Triangle (Back)
          gl.glColor3f(0.0f,0.0f,1.0f);                  // Blue
          gl.glVertex3f(-1.0f,-1.0f, -1.0f);                  // Right Of Triangle (Back)
          gl.glColor3f(1.0f,0.0f,0.0f);                  // Red
          gl.glVertex3f( 0.0f, 1.0f, 0.0f);                  // Top Of Triangle (Left)
          gl.glColor3f(0.0f,0.0f,1.0f);                  // Blue
          gl.glVertex3f(-1.0f,-1.0f,-1.0f);                  // Left Of Triangle (Left)
          gl.glColor3f(0.0f,1.0f,0.0f);                  // Green
          gl.glVertex3f(-1.0f,-1.0f, 1.0f);                  // Right Of Triangle (Left)
          gl.glColor3f(1.0f, 1.0f, 1.0f);
          gl.glVertex3f( 1.0f,-1.0f, 1.0f);                  // Top Right  (Bottom)
          gl.glVertex3f(-1.0f,-1.0f, 1.0f);                  // Top Left  (Bottom)
          gl.glVertex3f(-1.0f,-1.0f,-1.0f);                  // Bottom  (Bottom)
          gl.glVertex3f( 1.0f,-1.0f,-1.0f);
          
          
          gl.glEnd();                                    // Finished Drawing The Triangle
        
    
        gl.glFlush();
        xrot+=0.4f;
        yrot+=0.4f;
        zrot+=0.4f;
      }
   
   public void reshape(GLDrawable gLDrawable, int x, int y, int width, int height)
      {
        final GL gl = gLDrawable.getGL();
        final GLU glu = gLDrawable.getGLU();

        if (height <= 0) // avoid a divide by zero error!
          height = 1; 
        final float h = (float)width / (float)height;
        gl.glViewport(0, 0, width, height);
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective(45.0f, h, 1.0, 20.0);
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glLoadIdentity(); 
      }

}

maybe anybody can give me a hint

I can’t believe I’m the one replying to a request for help, I’m greener than glColor3f(0.0f,1.0f,0.0f)! ^^;

Anyways, you should try not doing this in a single glBegin/end section. If you split triangles from quads it works fine:

    gl.glBegin(GL.GL_TRIANGLES);      // Drawing Using Triangles 
      gl.glColor3f(1.0f,0.0f,0.0f);   // Red 
      gl.glVertex3f( 0.0f, 1.0f, 0.0f);   // Top Of Triangle (Front) 
      gl.glColor3f(0.0f,1.0f,0.0f);   // Green 
      gl.glVertex3f(-1.0f,-1.0f, 1.0f);   // Left Of Triangle (Front) 
      gl.glColor3f(0.0f,0.0f,1.0f);   // Blue 
      gl.glVertex3f( 1.0f,-1.0f, 1.0f);   // Right Of Triangle (Front) 
      gl.glColor3f(1.0f,0.0f,0.0f);   // Red 
      gl.glVertex3f( 0.0f, 1.0f, 0.0f);   // Top Of Triangle (Right) 
      gl.glColor3f(0.0f,0.0f,1.0f);   // Blue 
      gl.glVertex3f( 1.0f,-1.0f, 1.0f);   // Left Of Triangle (Right) 
      gl.glColor3f(0.0f,1.0f,0.0f);   // Green 
      gl.glVertex3f( 1.0f,-1.0f, -1.0f);   // Right Of Triangle (Right) 
      gl.glColor3f(1.0f,0.0f,0.0f);   // Red 
      gl.glVertex3f( 0.0f, 1.0f, 0.0f);   // Top Of Triangle (Back) 
      gl.glColor3f(0.0f,1.0f,0.0f);   // Green 
      gl.glVertex3f( 1.0f,-1.0f, -1.0f);   // Left Of Triangle (Back) 
      gl.glColor3f(0.0f,0.0f,1.0f);   // Blue 
      gl.glVertex3f(-1.0f,-1.0f, -1.0f);   // Right Of Triangle (Back) 
      gl.glColor3f(1.0f,0.0f,0.0f);   // Red 
      gl.glVertex3f( 0.0f, 1.0f, 0.0f);   // Top Of Triangle (Left) 
      gl.glColor3f(0.0f,0.0f,1.0f);   // Blue 
      gl.glVertex3f(-1.0f,-1.0f,-1.0f);   // Left Of Triangle (Left) 
      gl.glColor3f(0.0f,1.0f,0.0f);   // Green 
      gl.glVertex3f(-1.0f,-1.0f, 1.0f);   // Right Of Triangle (Left)
    gl.glEnd();      // Finished Drawing The Pyramid
    gl.glBegin(GL.GL_QUADS);      // Drawing Using Quads
      gl.glColor3f(1.0f, 1.0f, 1.0f); 
      gl.glVertex3f( 1.0f,-1.0f, 1.0f);   // Top Right Of The Quad (Bottom) 
      gl.glVertex3f(-1.0f,-1.0f, 1.0f);   // Top Left Of The Quad (Bottom) 
      gl.glVertex3f(-1.0f,-1.0f,-1.0f);   // Bottom Left Of The Quad (Bottom) 
      gl.glVertex3f( 1.0f,-1.0f,-1.0f); 
    gl.glEnd();      // Finished Drawing The Quad

hmm maybe i should delet the comments from the bottom…
its the same bottom size like a quad… so i copied it …
but it is the bottom of the pyramide…

[quote]hmm maybe i should delet the comments from the bottom…
its the same bottom size like a quad… so i copied it …
but it is the bottom of the pyramide…
[/quote]
The comments don’t matter, they’re not processed. My guess is that the system becomes confused once it stops doing triangles because of the extra vertex. At any rate, doing it the way I posted makes it work (whereas doing it the way you did doesn’t render the bottom to me either).

Here, check this out:

aaah cool thank you !!!

Also try to keep in mind the winding order
of your polygon’s vertices. You can ask
OpenGL to cull either clockwise or anti-clockwise
polygons (i.e. front-facing or back-facing).
Try looking into: glEnable(GL_CULL_FACE),
glCullFace(…) and glFrontFace(…).

oke