Sign in to follow this  

Terrain

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

This topic is 3487 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this