LWJGL
May 22, 2012, 03:13:55 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: TextureLoader Tutorial  (Read 5473 times)
funkinlocke
Newbie
*
Posts: 8


« on: January 22, 2008, 07:16:46 »

I tried the TextureLoader Tutorial http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/devil/loadingtextures,
and for some reasons, I don't get it to work! I'm trying to load a jpeg-file.

I added

Code:
IL.create();
ILU.create();
ILUT.create();
      
after trying to load a Texture the first time, it throws a NullPointer-Exception when executing this part:

Code:
if (!IL.ilLoadFromURL(IL.class.getClassLoader().getResource(name))) {
return null;
}

I replaced it with:

Code:
if(!IL.ilLoadImage(name)) {
return null;
}

No the Exception is throwed around this part:

Code:
GL11.glGenTextures(scratch);

GL11.glBindTexture(GL11.GL_TEXTURE_2D, scratch.get(0));
oglImageHandle = scratch.get(0);


And I'm using it like this:

Code:
...
Texture tex = TexureLoader.loadTexture("resources/texture.jpg", false);
...

Does somebody got a clue whats wrong? Or is it my fault...I'm a bit confused...


Thanks in advance!
Logged
Matzon
Administrator
Demigod
*****
Posts: 2177



« Reply #1 on: January 22, 2008, 07:32:10 »

are you *sure* that it actually reads the file ?
Logged

http://certusgames.com (Free Online Multiplayer Java Games)
http://lwjgl.org (OpenGL/OpenAL for Java)
funkinlocke
Newbie
*
Posts: 8


« Reply #2 on: January 22, 2008, 08:36:45 »

are you *sure* that it actually reads the file ?


I checked the variables width,height, textureWidthSize & textureHeightSize and they are correct (256 all of them). I think they would be
something like 0 if the picture wasn't read properly...also the imageData-Object says that 262144 Elemtents are remaining.


Shall I post the code?


Logged
funkinlocke
Newbie
*
Posts: 8


« Reply #3 on: January 22, 2008, 08:41:13 »

are you *sure* that it actually reads the file ?


I checked the variables width,height, textureWidthSize & textureHeightSize and they are correct (256 all of them). I think they would be
something like 0 if the picture wasn't read properly...also the imageData-Object says that 262144 Elemtents are remaining.


Shall I post the code?





Forget about it, just found the error... i was calling the loading-function before GL11 was created...  Shocked


Thanks!
Logged
Pages: [1]
  Print  
 
Jump to:  

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