TextureLoader Tutorial

Started by funkinlocke, January 22, 2008, 15:16:46

Previous topic - Next topic

funkinlocke

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

IL.create();
		ILU.create();
		ILUT.create();

      
after trying to load a Texture the first time, it throws a NullPointer-Exception when executing this part:

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


I replaced it with:

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


No the Exception is throwed around this part:

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


And I'm using it like this:

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

Matzon

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

funkinlocke

Quote from: Matzon on January 22, 2008, 15:32:10
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?



funkinlocke

Quote from: funkinlocke on January 22, 2008, 16:36:45
Quote from: Matzon on January 22, 2008, 15:32:10
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...  :o


Thanks!