Example 7: Texture & Background image

Now we will see how to texturing objects with GLC_Texture class and how to add a background image with GLC_Viewport class.
Only the code related to texture and background image is developed.

Table of Contents 

1. GLWidget class

1.1. glwidget.cpp

// Create GLC_Object to display
void GLWidget::CreateScene()
    // Load Backfround image.

    // create a material with the specified texture
    GLC_Texture* pTexture= GLC_Factory::instance()->createTexture(QString::fromLatin1(":exemple07.png"));

    // Load "example07.obj"
    QFile fileEx07(QLatin1String(":example07.obj"));
    m_World= GLC_Factory::instance()->createWorldFromFile(fileEx07);


1.1.1. CreateScene()

Load the background image : see GLC_Viewport::loadBackGroundImage(), GLC_ImagePlane, GLC_Texture..
Create textured material : see GLC_Factory::createMaterial(), GLC_Material, GLC_Texture.
Load the World and assign the material to the first geometry of the scene.