LWJGL Forum

Archive => DevIL => Topic started by: Rainer on April 20, 2007, 06:35:40

Title: Problem loading textures
Post by: Rainer on April 20, 2007, 06:35:40
I did some random terrain generator:
(http://www.flugmodellbau.ch/bilder/terrain.jpg)

Now i would need to load a texture, would look much nicer then  ;D

First i tried the Tutorial ond this side (http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/devil/loadingtextures).
All i got was:
org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
        at org.lwjgl.opengl.Util.checkGLError(Util.java:56)
        at org.lwjgl.opengl.Display.swapBuffers(Display.java:555)
        at org.lwjgl.opengl.Display.update(Display.java:571)

After this, i tried the NeHe tutorial about loading textures. After changing:
IL.ilGenImages(1, image);
to
IL.ilGenImages(image);

it compiled fine, but when running, no texture is visible on the crate.

Any ideas  ???
Title: Re: Problem loading textures
Post by: bobjob on April 20, 2007, 08:20:39
hmmm you did the right thing regarding the function (removing the 1) as for the error, try print the path devil is trying to load.
Title: Re: Problem loading textures
Post by: Rainer on April 20, 2007, 09:11:54
I'm confused.
I tried around with the nehe lesson6, commenting out the loadtexture => everything is fine.
With the loadTexture either the crate is not visible at all or at seemingly at a random greyscale  ???
Same behavior with an impossibl path to the image, so i think it can't be found anyway.
Havent seen this with my previous testing, cause testing with random behavior is a bit difficult  ::)
Title: Re: Problem loading textures
Post by: Rainer on April 20, 2007, 09:31:10
Ok, NeHe Lesson 6 now running, i needed to specify the working directory in netbeans.

Unfortunately i have the "OpenGLException: Invalid operation (1282)" still when trying to load a Texture like described in the wiki...
Title: Re: Problem loading textures
Post by: Rainer on April 20, 2007, 09:52:28
Interesting:
New error after Clean and Build:
java.lang.NullPointerException
        at org.lwjgl.devil.IL.ilLoadFromURL(IL.java:536)
        at Game.loadTexture(Game.java:640)
        at Game.render(Game.java:200)
        at Game.run(Game.java:94)
        at Game.main(Game.java:58)
Title: Re: Problem loading textures
Post by: Rainer on April 20, 2007, 11:16:34
I'm confused  ???

The Nehe code works, so i copied the texture loading from the NeHe code into my class and tried to load the texture the same way as Nehe does. This resulted, once again, in an OpenGLException: Invalid operation (1282).

Then, i copied the other texloading code into the nehe code and tried to load, no error, but also no texture, just a white crate...
Title: Re: Problem loading textures
Post by: Rainer on April 20, 2007, 12:17:26
Problem found, stupid as expected:
Needet to load the texture in the init(), not later in render();  ::)
Title: Re: Problem loading textures
Post by: Rainer on April 20, 2007, 14:19:56
that's what it looks like now:
(http://www.flugmodellbau.ch/bilder/terrain2.jpg)
now i can begin to deal with the funny thins like collision detection  ::)