Ejemplo n.º 1
0
bool loadMedia()
{
    if( !gVBOTexture.loadTextureFromFile( "opengl.png" ) )
    {
        printf( "Unable to load OpenGL texture!\n" );
        return false;
    }

    return true;
}
Ejemplo n.º 2
0
bool loadMedia()
{
    // load texture
    if (!gNon2NTexture.loadTextureFromFile("./images/opengl.png")) {
        cout << "Unable to load non-power-of-two texture!" << endl;
        return false;
    }

    return true;
}
bool loadMedia()
{
    //Load and color key texture
    if( !gStretchedTexture.loadTextureFromFile( "11_stretching_and_filters/mini_opengl.png" ) )
    {
        printf( "Unable to load mini texture!\n" );
        return false;
    }

    return true;
}
bool loadMedia()
{
    //Load texture
    if( !gRepeatingTexture.loadTextureFromFile( "14_repeating_textures/texture.png" ) )
    {
        printf( "Unable to load repeating texture!\n" );
        return false;
    }

    return true;
}
Ejemplo n.º 5
0
bool loadMedia()
{
    // load texture
    if (!gCircleTexture.loadTextureFromFile("./images/circle.png")) {
        cout << "Unable to load circle texture!" << endl;
        return false;
    }

    // lock texture for modificatio
    gCircleTexture.lock();

    // calculate target color
    GLuint targetColor;
    GLubyte *colors = (GLubyte *)&targetColor;

    colors[0] = 000;
    colors[1] = 255;
    colors[2] = 255;
    colors[3] = 255;

    // replace target color with transparent black
    GLuint *pixels = gCircleTexture.getPixelData32();
    GLuint pixelCount = gCircleTexture.textureWidth() * gCircleTexture.textureHeight();

    GLuint i;
    for (i = 0; i < pixelCount; i++) {
        if (pixels[i] == targetColor)
            pixels[i] = 0;
    }

    // diagonal lines
    GLuint x, y;
    int factor = 10;
    for (y = 0; y < gCircleTexture.imageHeight(); y++) {
        for (x = 0; x < gCircleTexture.imageWidth(); x++) {
            if (y % factor != x % factor)
                gCircleTexture.setPixel32(x, y, 0);
        }
    }

    // update texture
    gCircleTexture.unlock();

    return true;
}