2
\$\begingroup\$

I am currently having an issue trying to initialize a frame buffer using LWJGL. When I try to call GL32.glFramebufferTexture(int, int, int, int) it throws a "Function is not supported" error. I have checked to make sure that the function is supported on my system using an OpenGL Extensions Viewer.

Here is the exact error:

Exception in thread "main" java.lang.IllegalStateException: Function is not supported
at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
at org.lwjgl.opengl.GL32.glFramebufferTexture(GL32.java:389)
at com.domain.name.graphics.GameWindow.startRendering(GameWindow.java:145)

Line 145 in GameWindow looks like:

GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, colID, 0);

colID is set as such:

colID = GL11.glGenTextures();

Any help would be very welcome.

System info & proof of function support: enter image description here

\$\endgroup\$
  • \$\begingroup\$ How do you initialize the library? It sounds like you may need to request/opt-in to GL3 features... \$\endgroup\$ – Josh Mar 8 '14 at 21:49
  • \$\begingroup\$ I am importing all OpenGL versions using import org.lwjgl.opengl.*; \$\endgroup\$ – OstlerDev Mar 8 '14 at 21:51
3
\$\begingroup\$

All your import does is bring the contents of those namespaces into scope.

It sounds like you probably didn't actually request an appropriately-versioned OpenGL context (that is, one with 3.2 support). To do so, you must provide context attributes requesting the desired version when you call Display.create()

PixelFormat pixelFormat = new PixelFormat();
ContextAttribs contextAtrributes = new ContextAttribs(3, 2)
    .withForwardCompatible(true)
    .withProfileCore(true);

try {
    Display.setDisplayMode(new DisplayMode(320, 240));
    Display.setTitle("Version selection");
    Display.create(pixelFormat, contextAtrributes);
} catch (LWJGLException e) {
    e.printStackTrace();
    System.exit(-1);
}
\$\endgroup\$
  • \$\begingroup\$ This may have solved the error, but I am not able to get that far in the code now. I now get the error: Exception in thread "main" java.lang.IllegalStateException: Function is not supported at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58) at org.lwjgl.opengl.GL11.glMatrixMode(GL11.java:2065) \$\endgroup\$ – OstlerDev Mar 8 '14 at 22:49
  • \$\begingroup\$ OpenGL 3 deprecated many legacy OpenGL functions, including the matrix stack functionality. You will need to upgrade your code to use modern OpenGL conventions and techniques if you want to use modern OpenGL. \$\endgroup\$ – Josh Mar 8 '14 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.