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


devIL usage by jeickmann
1
 
float * Geoclipmap::loadHeights(const string &filename)
{
    ILuint imageName = 0;

    ilGenImages(1, &imageName);
    
    ilBindImage(imageName);

    if(!ilLoadImage((ILstring) filename.c_str()))
    {
        cout << "Error loading image " << filename << endl;
        return 0;
    }

    heightmapsize = ilGetInteger(IL_IMAGE_WIDTH);
    float * heights = new float[heightmapsize*heightmapsize];
    ilCopyPixels(0, 0, 0, heightmapsize, heightmapsize, 1, IL_LUMINANCE, IL_FLOAT, heights);
    ilDeleteImages(1, &imageName);

    return heights;
}