GLC_lib Logo
      GLC_lib
OpenGL Library Class Support This Project

Home

Help
Examples
Screenshots
Download
Link
Forum
News

Example07 : Texture + Background image

 

exemple07_img

 

Now we will see how to texturing objects with  GLC_Texture class and how to add a background image with GLC_Viewport class.

 

Sources of the exemple07:

Download Source and binaries of this example.

Only the code related to texture and background image is developed.

GLWidget class

glwidget.cpp

// Create GLC_Object to display
void GLWidget::CreateScene()
{

	// Load Backfround image.
	m_GlView.loadBackGroundImage(":fond_exemple07.png");

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

	// Load "example07.obj"
	QFile fileEx07(":example07.obj");
	GLC_World* pWorld= m_pFactory->createWorld(fileEx07);

	m_World= (*pWorld);
	m_World.collection()->instancesHandle().first()->geomAt(0)->firstMaterial()->setTexture(pTexture);

	delete pWorld;
}

CreateScene()

 

SourceForge.net Logo

©2005-2011 Laurent Ribon