From: Ricardo O. <rio...@ya...> - 2001-09-28 15:38:33
|
-----Mensaje original----- De: gl4...@li... [mailto:gl4...@li...]En nombre de Kenneth B. Russell Enviado el: viernes, 28 de septiembre de 2001 17:02 Para: Ricardo Olanda CC: gl4...@li... Asunto: Re: [gl4java-usergroup] Problems with textures and gl parameters > 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(). _ ----------------- OK, now I change the state in the mouse and keyboard callbacks, but the problem is when I load a texture in display method, it cost time, well I load the textures, and I catch them, but in my aplication I fly over terrain, and I have to load textures while I am moving. How can I make a correct context, are there any example? Thanks _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |