Problem loading textures

Started by Rainer, April 20, 2007, 06:35:40

Previous topic - Next topic

Rainer

I did some random terrain generator:


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  ???

bobjob

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.

Rainer

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  ::)

Rainer

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...

Rainer

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)

Rainer

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...

Rainer

Problem found, stupid as expected:
Needet to load the texture in the init(), not later in render();  ::)

Rainer

that's what it looks like now:

now i can begin to deal with the funny thins like collision detection  ::)