java.lang.IllegalStateException: Function is not supported

Started by lainmaster, September 07, 2009, 23:10:15

Previous topic - Next topic

lainmaster

I get the following error when running my game under Windows 7 RC 7100. It works fine in XP. (Running from NetBeans 6.7 or 6.5, both give me the same)

java.lang.IllegalStateException: Function is not supported
        at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:64)
        at org.lwjgl.opengl.GL11.glGetError(GL11.java:1360)
        at org.lwjgl.opengl.Util.checkGLError(Util.java:52)
        at org.lwjgl.opengl.GL11.glGetString(GL11.java:1795)
        at org.lwjgl.opengl.GLContext.getSupportedExtensions(GLContext.java:185)
        at org.lwjgl.opengl.ContextCapabilities.initAllStubs(ContextCapabilities.java:3438)
        at org.lwjgl.opengl.ContextCapabilities.<init>(ContextCapabilities.java:3684)
        at org.lwjgl.opengl.GLContext.useContext(GLContext.java:328)
        at org.lwjgl.opengl.Context.makeCurrent(Context.java:183)
        at org.lwjgl.opengl.Display.makeCurrent(Display.java:713)
        at org.lwjgl.opengl.Display.makeCurrentAndSetSwapInterval(Display.java:865)
        at org.lwjgl.opengl.Display.create(Display.java:843)
        at org.lwjgl.opengl.Display.create(Display.java:767)
        at org.lwjgl.opengl.Display.create(Display.java:748)
        at ecl.client.Main.initializeGears(Main.java:251)
        at ecl.client.Main.run(Main.java:123)
        at java.lang.Thread.run(Thread.java:619)
Exception in thread "Thread-0" java.lang.IllegalStateException: Function is not supported
        at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:64)
        at org.lwjgl.opengl.GL11.glEnable(GL11.java:1031)
        at ecl.client.Main.initializeGears(Main.java:257)
        at ecl.client.Main.run(Main.java:123)
        at java.lang.Thread.run(Thread.java:619)


This is ecl.client.Main.run:

public void initializeGears(){
		try {
			if(_oCanvas != null){
				Display.setParent(_oCanvas);
			}else{
				Display.setTitle(WINDOW_TITLE);
				setDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, _bFullscreen);
			}
			Display.create(); // ERROR HERE!!!! (Windows 7 only)
		} catch (Exception ex) {
//			_oClientThread.send(Messaging.publicChat(ex.getMessage()));
			ex.printStackTrace();
		}
		Mouse.setGrabbed(false);
		GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
		GL11_EnterOrtho();
//		GLU.gluOrtho2D(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
		GL11.glDepthMask(false);
//		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
//		GL11.glPushAttrib(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_ENABLE_BIT);


		System.err.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
		System.err.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
		System.err.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
		System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix);
		System.err.println("OS: " + System.getProperty("os.name"));
		System.err.println("Available Processors:" + java.lang.Runtime.getRuntime().availableProcessors());
		System.err.println("Total Memory: " + ecl.util.Util.getSizeInPositiveBiggestUnit( Runtime.getRuntime().totalMemory()));
	}


Maybe it's an issue with Windows 7? It used to work in Windows 7 RC 7100 - but I use XP mostly, so I did some months of development before I got to try it again in 7. And now it' doesn't wanna run =/

EDIT

Just noticed I'm using lwjgl 2.2 now. Last time it worked fine in 7, it was using 2.1! Can it be that?

Ciardhubh

It's a general bug in LWJGL 2.2. This happens for me on Display.create(), e.g. simply:
    public static void main(String args[]) throws LWJGLException {
        Display.create();
    }


I've taken a closer look at it and in org.lwjgl.opengl.ContextCapabilities#initAllStubs(boolean) the call "Set supported_extensions = GLContext.getSupportedExtensions();" accesses some function pointers that have not yet been initialised (thus they are 0 and get reported as not supported). These function addresses are initialised a few lines later in "if (!GL11_initNativeFunctionAddresses(forwardCompatible))". It's probably an issue due to some new GL31 initialisations. In 2.1 the call to getSupportedExtensions was after GL11_initNativeFunctionAddresses so the necessary function addresses were already initialised.

The class ContextCapabilities seems to be automatically generated, so the generator (org.lwjgl.util.generator.ContextCapabilitiesGenerator#generateInitStubsPrologue(...)) would have to be fixed. Possibly by adding another special case for "GL11_glGetError_pointer". Seems a bit hackish though, but I haven't read through the whole generation process.

This only happens with lwjgl-debug.jar. lwjgl.jar works fine (at least for the short tests I ran, e.g. displaying a textured quad). I remember reading that lwjgl.jar has no error checks so it might work as glGetError will have been initialised afterwards.

Matzon

maybe spasi has some insight into this - I will try to ping him.

spasi

Everything Ciardhubh said is correct. The glGetError pointer has been added to the list of functions necessary for context initialization (yes, it's an awkward hack) and the debug jar should work without problems now.

lainmaster


princec


spasi


lainmaster

Yay =) Since it works fine in Windows XP for me, I'm just gonna go on programming under XP for now.

Matzon

doing a 2.2.1 release would probably require a 2.2 release? ;)

I've been holding back doing the release because there are still some issues left ... but since no one is picking up on those I guess we might as well ger 2.2 out the door.

Simon Felix

Download Cultris II, the fastest Tetris clone from http://gewaltig.net/


princec

The input ones are probably the most irritating. Not too bothered about UTF-8 as it has an easy workaround (use an AWT window for now).

Cas :)

kappa

another (input/applet) bug is the Mouse.setGrabbed(boolean) not working on Windows when using Display.setParent (important for applets, Minecraft dev was complaining about it).


Matzon