|
From: Kenneth B. R. <kbr...@al...> - 2001-09-28 15:01:54
|
> I have a problem, I only can load textures in the display method, or in the > init, my aplication read a file with urls of images, and I want to load > them when I read the text file, but I can't, it says me: > "GLUT : Warning in (unamed): GL error: operation not valid" > > when I try to execute: > TextureLoader texLoader = new AWTTextureLoader(this,gl,glu); > > If I execute this in the display function it works ok. You need a valid OpenGL context in order to make OpenGL calls. GL4Java automatically makes the context current before calling display(), init(), reshape(), and a couple of other routines. While you can force the context to be made current outside of these routines, you may find it easier to rearrange your initialization code to run inside these. In a couple of applications I've written, the keyboard and mouse callbacks (which execute in the AWT thread without an OpenGL context available) simply set some state which is then processed in display(). |