GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


vector.h by MrDutchy
1
 
#include "tview.h"
#include "vector.h"

//    This returns the height into the height map
int Height(BYTE *pHeightMap, int X, int Y)
{
    int x = X % MAP_SIZE;                    // Error check our x value
    int y = Y % MAP_SIZE;                    // Error check our y value

    if(!pHeightMap) return 0;                // Make sure our data is valid

    return pHeightMap[x + (y * MAP_SIZE)];    // Index into our height array and return the height
}

//    This renders the height map as QUADS
void RenderHeightMap(BYTE pHeightMap[])
{
    BindBuffer(GL_ARRAY_BUFFER_ARB, 1);                    // buffer setzen
    glVertexPointer(3, GL_FLOAT, 0, (char *) NULL);        // VertexPointer auf oben gesetzten vertex buffer object zeigen lassen

    BindBuffer(GL_ARRAY_BUFFER_ARB, 2);                    // buffer setzen
    glNormalPointer(GL_FLOAT, 0, (char *) NULL);        // NormalPointer auf oben gesetzten normal buffer object zeigen lassen

    BindBuffer(GL_ARRAY_BUFFER_ARB, 3);                    // buffer setzen
    glTexCoordPointer(2, GL_FLOAT, 0, (char *) NULL);    // TexCoordPointer auf oben gesetzten texcoord buffer object zeigen lassen

    glEnable(GL_TEXTURE_2D);                            // Texturing enablen und terraintextur aktivieren
    glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
    
    glEnableClientState(GL_VERTEX_ARRAY);                // f