Why does LWJGL throw such an error?

I want to draw a cube by using lwjgl, an error was thrown when using glBegin():
my codes:


        // top
        glVertex3f(-x, y, z);
        glVertex3f(-x, y, -z);
        glVertex3f(x, y, -z);
        glVertex3f(x, y, z);
        glVertex3f(-x, y, z);
        glVertex3f(x, y, -z);

my errors:

java.lang.IllegalStateException: Function is not supported
at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
at org.lwjgl.opengl.GL11.glBegin(GL11.java:682)

Does anyone know what this is about?

1 Like

Functions that are part of “Immediate Mode” are deprecated, and are not available with OpenGL 3.1 core profile. You need to be running with “compatibility profile.”

There is a link to this information in the LWJGL javadoc for GL11.

1 Like

I’m a little new to Opengl .What exactly should I do?

I think you forgot the link.

Since this has nothing at all to do with jMonkeyEngine, you may want to try asking for lwjgl help on lwjgl forums.

If you want to do this same thing with JME instead then get back to us.