OpenGL Exception

Started by Kokoni, July 08, 2004, 16:30:35

Previous topic - Next topic

Kokoni

Hello all,

I'm using LWJGL 0.9a and I have an OpenGL  Exception when I use "Window.update();" in this code :

// Main Loop
while (!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
       if (Window.isVisible()) {

             mycamera.update();
             render();
             Window.update();
	}
}


The error is :

org.lwjgl.opengl.OpenGLException: Invalid value (1281)
   at org.lwjgl.opengl.Util.checkGLError(Unknown Source)
   at org.lwjgl.opengl.Window.update(Unknown Source)
   at org.jengl.core.JENGL.main_loop(JENGL.java:250)
   at org.jengl.core.JENGL.launch(JENGL.java:126)
   at Demo1.main(Demo1.java:39)
Exception in thread "main"

In the render() methode, I just draw a simple trianngle.

Thank you,

[EDIT]
My Window is created by :
...
Window.create( "Test", 50, 50, 800, 600, 32, 0, 8, 0);
...



Kokoni

CaptainJester

The problem is not actually with the Window.update().  You probably used an invalid value when you set up textures or something else.  If you use org.lwjgl.opengl.Util.checkGLError, you can pinpoint where the error actually occured.

Something like:
initGL();
org.lwjgl.opengl.Util.checkGLError
loadTextures();
org.lwjgl.opengl.Util.checkGLError


checkGLError will throw an exception if an error occured.  So using the example, you can tell if the error is in initGL or loadTextures.  Then you can drill down into finer detail.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

Kokoni

Thank you Captain !

I check it was my (crappy) textures loader at this line :
GL11.glTexImage2D(  GL11.GL_TEXTURE_2D, 
                                 0, 
                                 GL11.GL_RGB, 
                                 tex.getWidth(), 
                                 tex.getHeight(),
                                 0, 
                                 GL11.GL_RGB,
                                 GL11.GL_UNSIGNED_BYTE, 
                                 scratch);


I will check it, thank you again for the tip  :)


Kokoni

Kokoni

My last error is now check (my texture was 1014x1024 instead of 1024x1024 ...).

But now I have a strange VM error, because I use GL11.glGetFloat() method :

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x696B6DE8
Function=[Unknown.]
Library=C:\WINDOWS\System32\nvoglnt.dll

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
	at org.lwjgl.opengl.GL11.nglGetFloatv(Native Method)
	at org.lwjgl.opengl.GL11.glGetFloat(Unknown Source)
	at org.jengl.core.ps.Frustum.calculateFrustum(Frustum.java:63)
	at org.jengl.core.Camera.update(Camera.java:331)
	at org.jengl.core.JENGL.main_loop(JENGL.java:268)
	at org.jengl.core.JENGL.launch(JENGL.java:128)
	at Demo1.main(Demo1.java:39)

Dynamic libraries:
0x00400000 - 0x00407000 	C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe
0x77F40000 - 0x77FEE000 	C:\WINDOWS\System32\ntdll.dll
0x77E40000 - 0x77F36000 	C:\WINDOWS\system32\kernel32.dll
0x77DA0000 - 0x77E3E000 	C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78087000 	C:\WINDOWS\system32\RPCRT4.dll
0x77D10000 - 0x77D9C000 	C:\WINDOWS\system32\USER32.dll
0x7E0B0000 - 0x7E0F1000 	C:\WINDOWS\system32\GDI32.dll
0x77BE0000 - 0x77C33000 	C:\WINDOWS\system32\MSVCRT.dll
0x08000000 - 0x08138000 	C:\Program Files\Java\j2re1.4.2_04\bin\client\jvm.dll
0x76AE0000 - 0x76B0E000 	C:\WINDOWS\System32\WINMM.dll
0x10000000 - 0x10007000 	C:\Program Files\Java\j2re1.4.2_04\bin\hpi.dll
0x00820000 - 0x0082E000 	C:\Program Files\Java\j2re1.4.2_04\bin\verify.dll
0x00830000 - 0x00849000 	C:\Program Files\Java\j2re1.4.2_04\bin\java.dll
0x00850000 - 0x0085D000 	C:\Program Files\Java\j2re1.4.2_04\bin\zip.dll
0x02E40000 - 0x02E7A000 	C:\WINDOWS\system32\lwjgl.dll
0x721F0000 - 0x7221A000 	C:\WINDOWS\System32\DINPUT.dll
0x5F070000 - 0x5F136000 	C:\WINDOWS\System32\OPENGL32.dll
0x68F80000 - 0x68F9F000 	C:\WINDOWS\System32\GLU32.dll
0x51000000 - 0x51047000 	C:\WINDOWS\System32\DDRAW.dll
0x73B10000 - 0x73B16000 	C:\WINDOWS\System32\DCIMAN32.dll
0x77BD0000 - 0x77BD7000 	C:\WINDOWS\system32\VERSION.dll
0x5B090000 - 0x5B0C4000 	C:\WINDOWS\System32\uxtheme.dll
0x69500000 - 0x698BE000 	C:\WINDOWS\System32\nvoglnt.dll
0x68D50000 - 0x68D59000 	C:\WINDOWS\System32\HID.DLL
0x76610000 - 0x766FC000 	C:\WINDOWS\System32\SETUPAPI.DLL
0x03D40000 - 0x03E4F000 	C:\Program Files\Java\j2re1.4.2_04\bin\awt.dll
0x72F50000 - 0x72F73000 	C:\WINDOWS\System32\WINSPOOL.DRV
0x76320000 - 0x7633C000 	C:\WINDOWS\System32\IMM32.dll
0x7CCC0000 - 0x7CDE4000 	C:\WINDOWS\system32\ole32.dll
0x03E60000 - 0x03EB0000 	C:\Program Files\Java\j2re1.4.2_04\bin\fontmanager.dll
0x5C000000 - 0x5C0C8000 	C:\WINDOWS\System32\D3DIM700.DLL
0x76C40000 - 0x76C62000 	C:\WINDOWS\system32\imagehlp.dll
0x6D9E0000 - 0x6DA5D000 	C:\WINDOWS\system32\DBGHELP.dll
0x76BA0000 - 0x76BAB000 	C:\WINDOWS\System32\PSAPI.DLL

Heap at VM Abort:
Heap
 def new generation   total 2688K, used 48K [0x10010000, 0x102f0000, 0x104f0000)
  eden space 2432K,   1% used [0x10010000, 0x1001c158, 0x10270000)
  from space 256K,   0% used [0x102b0000, 0x102b0000, 0x102f0000)
  to   space 256K,   0% used [0x10270000, 0x10270000, 0x102b0000)
 tenured generation   total 34784K, used 23942K [0x104f0000, 0x126e8000, 0x14010000)
   the space 34784K,  68% used [0x104f0000, 0x11c51880, 0x11c51a00, 0x126e8000)
 compacting perm gen  total 4352K, used 4125K [0x14010000, 0x14450000, 0x18010000)
   the space 4352K,  94% used [0x14010000, 0x144175f8, 0x14417600, 0x14450000)

Local Time = Thu Jul 08 21:05:38 2004
Elapsed Time = 2
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_04-b05 mixed mode)
#
# An error report file has been saved as hs_err_pid3916.log.
# Please refer to the file for further information.
#


I don't know if I made a mistake or if this method is not bind with native code or something else. Someone can help me please?

Thanks,


Kokoni

CaptainJester

Did you load the FloatBuffer before calling the method?  I know with glGetInteger, I had to load the IntBuffer with a size 16 array of int before it would work.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

Kokoni

I use the following code :

...
FloatBuffer proj = FloatBuffer.allocate(16);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, proj);
...


This code is called after each camera.update() for computing the camera frustum.

I think "allocate()" load the buffer but I'm not sure  it is what you meant.

cfmdobbie

Nope, buffers in LWJGL need to be direct and ordered.  Instead of repeating all the code to do this yourself, use the BufferUtils class thusly:

FloatBuffer proj = org.lwjgl.BufferUtils.createFloatBuffer(16);
ellomynameis Charlie Dobbie.

Kokoni

Cool, thank you for your help, no more error now  :)

princec

I think we're going to have to put an Exception trap in for this case as it's very common and leads to a VM crash. Which is very bad.

Cas :)

cfmdobbie

That would be a very nice addition indeed. Bonus points for an exception message that even gives the correct code fragment to use! :D
ellomynameis Charlie Dobbie.