Problem with loading textures - EXCEPTION_ACCESS_VIOLATION (0xc0000005)

Hey all,





I have SWT application and using Canvas and extending SimpleCanvasImpl I get everything working fine,



I have application App class which controls stuff.

I want to load skybox(and any other spatial next), when i am building skybox i got exception which

i put down. But when i comment,

  Texture t = TextureManager.loadTexture(…)



it works (of course i don't see any skybox but i is added to rootNode)



From the other hand when i call buildSkyBox from MyImplementator it works :confused:





any ideas?









#

An unexpected error has been detected by HotSpot Virtual Machine:

#

#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00add6df, pid=2700, tid=1528

#

Java VM: Java HotSpot™ Client VM (1.5.0_06-b05 mixed mode)

Problematic frame:

j  org.lwjgl.opengl.GL13.glActiveTexture(I)V+0

#

An error report file with more information is saved as hs_err_pid2700.log

#

If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

All GL calls must come from a single thread. As loadTexture currently performs GL class (loads the texture into GPU memory) you have to take case that you call it from the same thread than all other GL related stuff (e.g. creating canvas etc.). I'm not really familiar with SWT so perhaps somebody else can tell you about the actual threads there…

Well. SWT uses the thread in which the Display object is created as it's UI thread. AFAIK it won't create any additional thread, so I don't think SWT is causing you those problems.

Ok, then most probably there are two thread as in awt, right? One 'display' thread and the main thread. Be sure to invoke all GL stuff from one of those thread. This should solve the problem.

Yes, i have two threads and the main one was invoking GL stuff also.



So I use Queue, main one put Properties for new Node, then the 'display' thread take it in update method

and create it. That works.



Now i have to face with the problem of returning that Node to main thread…



thx,