LWJGL
May 25, 2013, 10:32:35 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Problem loading textures  (Read 7796 times)
Rainer
Regular nerd
**
Posts: 71


« on: April 19, 2007, 23:35:40 »

I did some random terrain generator:


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

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  Huh
Logged
bobjob
Prolific Timewaster
****
Posts: 335


LWJGL: WOW SO GOOD


« Reply #1 on: April 20, 2007, 01: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.
Logged

LWJGL Benchmark online test:
http://have2chat.net/benchmark/
http://have2chat.net/benchmark/fullpage.html (run full OpenGL webpage)
Rainer
Regular nerd
**
Posts: 71


« Reply #2 on: April 20, 2007, 02: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  Huh
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  Roll Eyes
Logged
Rainer
Regular nerd
**
Posts: 71


« Reply #3 on: April 20, 2007, 02: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...
Logged
Rainer
Regular nerd
**
Posts: 71


« Reply #4 on: April 20, 2007, 02: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)
Logged
Rainer
Regular nerd
**
Posts: 71


« Reply #5 on: April 20, 2007, 04:16:34 »

I'm confused  Huh

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...
Logged
Rainer
Regular nerd
**
Posts: 71


« Reply #6 on: April 20, 2007, 05:17:26 »

Problem found, stupid as expected:
Needet to load the texture in the init(), not later in render();  Roll Eyes
Logged
Rainer
Regular nerd
**
Posts: 71


« Reply #7 on: April 20, 2007, 07:19:56 »

that's what it looks like now:

now i can begin to deal with the funny thins like collision detection  Roll Eyes
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!