Example 6: Loading OBJ File

Now we will see how to load a 3D Model file with the GLC_Factory and display it by GLC_World class. In this example an OBJ file format is loaded.
Other supported format can be loaded in the same way. (The file extension is used by GLC_Lib to determine the file format.)

Table of Contents 

Only the code related to load and display the 3D model is developed.

1. GLWidget class

1.1. glwidget.cpp

// Create GLC_Object to display
void GLWidget::CreateScene()
{
// Load mesh from a file
QFile manFile(":man.obj");
m_World= GLC_Factory::instance()->createWorldFromFile(manFile);

}

see GLC_Factory class, and GLC_World class. Note that the copy of a GLC_World is a shallow copy.

Tags: