Example From Wiki Tutorial Doesn't Render

Started by ido, August 01, 2009, 16:34:08

Previous topic - Next topic

ido

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 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).

Fool Running

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.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D


Matzon


jonkri

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