0

Hi, I have a program that loads in a heightmap data from a text file. The problem i have is i don't really have a clue what do do with it.

I have to call glTexImage2D to set up the text, how would i use that? Oh and the data from the heightmap text file is stored in a floating point array.

Any tutorials or help os very welcome and much appreciate.

My OpenGL isn't very good to be honest.

Thanks in advanced.

3
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by PsychoLogic
0

Well what do you intend to use the heightmap for? One use for them is to create a terrain based on the heightmap. For example, you would use the heightmap values to map the height of the plane at a given point.

0

Well its not really being used for anything. I need to just display the heightmap. Nothing special, just to use it really.

0

What do you mean you want to display the heightmap? I am assuming your "heightmap" is a file with bunch of numbers? How would you display that? Do you mean to print it?

0

Yeah its a text file with a bunch of numbers in it. See this is the problem i have, is i that my understand isn't to good.

The overall this i have to do is render a 3D surface using a heightmap. Is that a little better?

Thanks for the interest!

0

So first you need to be able to render a flat 3D surface, and for each point in the surface, you will use the heightmap as the heightvalue for that point.

0

Yeah thats the one. any ideas?

But to change the points to work with the heightmap i have to write a shader. But for no if i can get it working without the shader i'll be happy!

Thanks.

0

You don't need shaders. All you need to do is something like this :

for( int x = 0; x < MAP_WIDTH; ++x){
  for(int z = 0; z < MAX_HEIGHT; ++z){
    surface[x][y].setHeight( heightMap.getHeight(x,z) );
 }
}
0

Thats the problem, i just done the render function, but now i have to use a vertex shader to change the positions according to the heightmap.

0

you shouldn't have to use shaders for this. Setting height is just a numerical thing. Rendering it is different. You can render it with or without shaders

0

If you have to use a shader to manipulate the vertex data from a flat plane, the easiest way would be to load the height map into a texture, and extract the height value in the vertex shader using a call the texture2D.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.