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(). |
From: Kenneth B. R. <kbr...@al...> - 2001-10-01 07:25:52
|
> 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? You might want to look at the Grand Canyon demo at http://java.sun.com/products/jfc/tsc/articles/jcanyon/ This demo loads textures in a background thread and hands them off to the main thread. It uses JDK 1.4-specific APIs (and needs to be updated once GL4Java 2.8.0 is out) but the structure is reusable; see terrain.AsyncFetcher. |
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 |
From: Sven G. <sgo...@ja...> - 2001-09-28 23:58:28
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 28 September 2001 17:40, Ricardo Olanda wrote: > ----------------- > 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 > read the demo's there are listener modell demo's like gears and derivation ones (the old style of overwriting functions).. look in demos/MiscDemos for example (seek for gljMakeCurrent/gljFree pair's) you should update to the new gl4java @ sourceforge 2.8.0.5 prerelease, cause context switching is updated for your application, you should better buffer/read your textures before using them ! peace, sven - -- my concern about the current attack: http://www.jausoft.com/20010911-wtc/ mailto:sgo...@ja... www : http://www.jausoft.com ; pgp: http://www.jausoft.com/gpg/ voice : +49-521-2399440 ; fax : +49-521-2399442 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7tQ6fHdOA30NoFAARAtXDAKCu4MDNGP3lxEEbbUz3NBjmQ0rGTwCfWZui ugLjIMW6mk2TCTummI5+kr0= =YewQ -----END PGP SIGNATURE----- |