If i load a grayscale image with DevIL, how can i use the data to make a heightmap? what are the access functions for the pixel colors ? I could not find any.
Sorry to say, but im way too newbie to understand what to do with all that code, in order to do what i wanted (in the subject line).
for the easist way I would suggest using imageio to load the heightmap texture, then just use getRGB to get the value of a pixel at an (x,y) location: the value is an int where the highest byte is the alpha value, the second highest is red, then green, blue… but you only need one channel, since they are all the same if it is grayscale.
something like:
int height = bufferedImage.getRGB(x, y)&0xff;
Im a newbie… what is an “imageio” and how to use it to load bmp/jpg images?
So you basicly want us to write everything, put it in a method that you can call?
[quote]Im a newbie… what is an “imageio” and how to use it to load bmp/jpg images?
[/quote]
[url=http://www.google.com/search?q=imageio]google[/url] :
No.
First,
I dont even know in which library it is, and where is the documentation.
Second,
Why using some library, when DevIL exists?
I just dont understand how to implement DevIL for my needs.
If you actually followed that Google link and read what you found there you’d find the answers you seek. In the meantime I think you might want to research your questions first and avoid pestering people when you obviously need to do some research of your own first.
Cas 
Usually when i’m reading something about a new library, I dont fully understands.
Also, the DevIL documentation practictly dont exists. Just have the methods, and not how to use them.
I looked up for the “imageio” , and i found it, but i could not figure out what to do with it… “image stream” etc. dont mean nothing to me.
maybe i have a deeper problem. How do u guys understand such concepts?
You’re trying to write a poem in Chinese… buy a Chinese studybook first, spend a few months studying it.
After you know how to do the basics, you either know what to do all by yourself, or you can come back here and ask some intelligent questions.
There is no book in DevIL, i guess.
for example, when i see on the documentation:
ilIsValid(int Type, java.lang.String FileName)
I dont know what is it for, what is “Type” param and which constant values are valid for it, etc.
anyhoo, i’ve got the following code:
IntBuffer image = BufferUtil.newIntBuffer(1);
IL.ilGenImages(image);
IL.ilBindImage(image.get(0));
IL.ilLoadImage("Data/heightmap1.bmp");
IL.ilConvertImage(IL.IL_RGB, IL.IL_BYTE);
ByteBuffer scratch = IL.ilGetData();
for (int i=0;i<500;i++)
System.out.println(""+i+": "+scratch.get(i));
why do i see negative numbers on the output?
Appearantly you don’t realize how bytes are representated in memory.
What about learning Java for a start.
This is what I meant with starting with the basics, otherwise you’ll have to ask so many questions, that you wouldn’t make any progress anyway.
“Thinking in Java” is worth every cent.
Thanks 
anyway, I’ve figured it out i think. I just keep getting that annoying runtime bug again and again.