Jump to content
  • Advertisement
Sign in to follow this  
CallMeYellow

Terrain

This topic is 3790 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

How am i suppose to edit the code to change the pattern of the terrain? I tried changing here and there but the pattern is still the same. >< glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); for (int z = 0; z < TERRAIN_SIZE - 1; ++z) { glBegin(GL_TRIANGLE_STRIP); for (int x = 0; x < TERRAIN_SIZE; ++x) { GLfloat scaledHeight = heightmap[z * TERRAIN_SIZE + x] / SCALE_FACTOR; GLfloat nextScaledHeight = heightmap[(z + 1)*TERRAIN_SIZE + x]/SCALE_FACTOR; // assign texture coordinates for texture unit 0 glMultiTexCoord2f(GL_TEXTURE0, x * TC_SCALE, z * TC_SCALE); glVertex3f((GLfloat)x - TERRAIN_SIZE/2, scaledHeight, (GLfloat)z - TERRAIN_SIZE/2); // assign texture coordinates for texture unit 0 glMultiTexCoord2f(GL_TEXTURE0, x * TC_SCALE, (z + 1) * TC_SCALE); glVertex3f((GLfloat)x - TERRAIN_SIZE/2, nextScaledHeight, (GLfloat)(z + 1) - TERRAIN_SIZE/2); } glEnd(); }

Share this post


Link to post
Share on other sites
Advertisement
Do you wish to change the topography or the texture? The topography is stored in the heightmap. You can see how that's used to the Z coordinate. The texture is loaded elsewhere in your code, probably from an image.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!