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 ???
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.
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 ::)
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...
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)
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...
Problem found, stupid as expected:
Needet to load the texture in the init(), not later in render(); ::)
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 ::)