LWJGL Forum

Programming => OpenGL => Topic started by: ido on August 01, 2009, 16:34:08

Title: Example From Wiki Tutorial Doesn't Render
Post by: ido on August 01, 2009, 16:34:08
Hi,
I've been going through some of the tutorials, playing around with the simple code in this one:

http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/basicopengl

Unfortunately, it doesn't seem to work - my code (http://github.com/ido/LwjglExample/blob/83f931f53e006dd86f9a760c4fbe2bb2be72183e/src/LwjglClient.java) only displays a black screen without the square.

Is that a bug or am I don't something wrong?

-Ido.

EDIT: I tried also simply copy pasting the example from the wiki verbatim, and still got the same result - a blank screen (with 2.1.0, tried on linux 64 bits & windows 32 bits).
Title: Re: Example From Wiki Tutorial Doesn't Render
Post by: Fool Running on August 03, 2009, 15:45:59
It looks like that tutorial is really old. When LWJGL 2.0 was released, the startup code was changed to not set up a orthographic viewport (2D view), but to use the standard OpenGL default viewport. This caused a lot of the tutorials to stop working. Unfortunately, no one has fixed them. :(

To make the tutorial work as it did before, you need to add

GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight(), -1, 1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);

to the beginning of the render() method. That should allow it to show correctly.
Title: Re: Example From Wiki Tutorial Doesn't Render
Post by: ido on August 03, 2009, 16:29:01
OK, thanks a lot!
Title: Re: Example From Wiki Tutorial Doesn't Render
Post by: Matzon on August 03, 2009, 17:47:07
updated wiki
Title: Re: Example From Wiki Tutorial Doesn't Render
Post by: jonkri on August 03, 2009, 17:54:03
Quote from: Matzon on August 03, 2009, 17:47:07
updated wiki

Great! I was going to but I had not figured out how quite yet... :P