Clarify someones work please
PHP Code:
//$Author: DigiBen [email][email protected][/email] //
// We want to calculate the texture coordinate for the current vertex.
// To do this, we just take the current x and y and divide them by the
// MAP_SIZE of our terrain. This is of course assuming the height map
// has the same width and height. Notice that we negate the v value (IE, (u, v)).
// This is because we need to flip the texture upside down so it lines up correctly.
// This simple math we use to find the texture coordinate can be explained easily.
// We know that our terrain is made up of a grid, and that if we want to stretch
// the entire texture over top of that grid, we just divide the current section
// of the grid by the total section of the grid, which gives us a ratio from 0
// to 1. This works great because the (u, v) coordinates for a texture map go
// from (0, 0) in the top left corner to (1, 1) in the bottom right corner.
// Give OpenGL the current texture coordinate for our height map
glTexCoord2f( (float)x / (float)MAP_SIZE,
- (float)z / (float)MAP_SIZE );
That is correct, even I figured that out myself..
I do not get why the v has to be negetive....What is he talking about???
What does a -v do?