LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Hungry Joe on March 24, 2004, 19:56:25

Title: Can someone help me?
Post by: Hungry Joe on March 24, 2004, 19:56:25
My screen is all black. I think there ought to be a red triangle in it. And maybe a white square.

http://82.35.9.23/game.rar anyone got any ideas?
Title: Can someone help me?
Post by: cfmdobbie on March 24, 2004, 20:04:45
Got a zip file, or post some source code?

At a guess, make sure you're calling Window.paint() at the end of each frame to flush all drawing and swap the buffers.
Title: Can someone help me?
Post by: Hungry Joe on March 24, 2004, 21:57:01
that link should let you download all my source.
Title: Can someone help me?
Post by: cfmdobbie on March 24, 2004, 22:17:39
But as a rar - I don't do rars!  Got a zip?  Or a tarball?  Or just a text file?
Title: Can someone help me?
Post by: Hungry Joe on March 24, 2004, 22:47:50
(http://82.35.9.23/wtf2.png)

what the heck is going on now?? This should be a plain white triangle strip displaying a quad. Heres my GL ini

private void init_gl() {
      GL.glShadeModel(GL.GL_SMOOTH); // Enable Smooth Shading
      GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
      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.glMatrixMode(GL.GL_PROJECTION); // Select The Projection Matrix
      GL.glLoadIdentity(); // Reset The Projection Matrix
      // Calculate The Aspect Ratio Of The Window
      GLU.gluPerspective(45.0f, (float) Display.getWidth()
            / (float) Display.getHeight(), 0.1f, 100.0f);
      GL.glMatrixMode(GL.GL_MODELVIEW); // Select The Modelview Matrix
      // Really Nice Perspective Calculations
      GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
      //sync to monitor
      Window.setVSyncEnabled(true);
   }
Title: Can someone help me?
Post by: Hungry Joe on March 24, 2004, 22:50:54
wow othis is the third time ive fixed something tonight without any help! I changed the method used for the depthbuffer to GEQUAL instead of LEQUAL
Title: Can someone help me?
Post by: princec on March 25, 2004, 09:15:03
Normally you'd be using glClearDepth(0.0f).

Cas :)
Title: Can someone help me?
Post by: Hungry Joe on March 25, 2004, 18:04:11
weird. today I had to change it back to LEQUAL to get rid of the artifacting.

Thanks for the tip princec,I just copied that out of a NeHe example in sourceforge and would never have spotted it.