Heightmap and Textures

Posted by Robert on Game Development See other posts from Game Development or by Robert
Published on 2013-07-11T09:17:58Z Indexed on 2013/11/08 22:19 UTC
Read the original article Hit count: 245

Filed under:
|
|

Im trying to find the "best way" to apply a texture to a heightmap with opengl 3.x.

Its really hard to find something on google because tutorials are olds and they're all using different methods, im really lost and i dont know what to use at all.

Here is my code that generates the heightmap (its basic)

    float[] vertexes = null;
    float[] textureCoords = null;

    for(int x = 0; x < this.m_size.width; x++)
    {
        for(int y = 0; y < this.m_size.height; y++)
        {
            vertexes ~= [x, 1.0f, y];
            textureCoords ~= [cast(float)x / 50, cast(float)y / 50];
        }
    }

As you can see, i dont know how to apply the texture at all (i was using / 50 for my tests).

Result of that code :

enter image description here

I would like to have something very basic like :

enter image description here

(you can find more pics in his blog)

Edit : my texture size is 1024x1024.

© Game Development or respective owner

Related posts about opengl

Related posts about textures