Skip to content
Advertisement

LWJGL – OpenGL not rendering

The following LWJGL code is expected to render a blueish square in the center of the screen. Instead, I get a blank white screen. It’s like the rendering is not working at all, or that I am rendering outside of the screen.

I’m a complete noob in OpenGL and LWJGL, so I’m out of my depth. I went through everything but can’t seem to find anything that might be wrong with the code.

OpenGLTest.scala

JavaScript

VertexArray.scala

JavaScript

Advertisement

Answer

The call of

JavaScript

will cause an INVALID_ENUM error. The parameter to glEnable has to be a single enumerator constant. The parameter is not a bit mask where, the values can be concatenated by |.

JavaScript

If you want to clear the buffers, then you’ve to call glClear. The parameter of glClear is a bit mask that indicate the buffers to be cleared:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement