Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

com

applying a bitmap to a height map?

This topic is 5652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

is there any way i can apply a bitmap to my height map so thta the terran looks real?

Share this post


Link to post
Share on other sites
Advertisement
I mean im using the tutorail from nehe thats on height maps and i would like to apply a bitmap so that i can paint it over the height map as in adding a texture so that it looks like real terrain.

Share this post


Link to post
Share on other sites
maybe you could be a little more presise?
like would i use LoadGLTextures() etc or is there a certain way of doing it with raw files?

Share this post


Link to post
Share on other sites
You want to add a texture to the terrain..

Now think, what do you need do draw a texture? (You should have learned that in Nehe''s Tutorials )

Load the texture, calculate the texture coordinates, apply the texture.

Have a look at gametutorials.com, they have a good tutorial on this.

Share this post


Link to post
Share on other sites
Specific?

Without being too blunt...


In your initialization:
1. Load your heightmap
2. Load your texture

In your render:

1. glBindTexture(GL_TEXTURE_2D, );
2. glBegin(...);
3. glTexCoord2f( u, v ); <- Use simple math
u = 1 / (width of texture) * x coord
(work it out for v the same way)
4. glVertex3f(x, y, z);

5. Keep going


It isnt hard, although it is complicated at first. Persist and you will do fine. Or you could just work at McDonalds.

Just remember that a textured triangle needs a texture, 3 vertices and 3 texture coordinates. (And 1 to 3 normals if you use lighting).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!