### Mesh Loading and Rendering 3 (3/7)

Description

Now we will go into more detail on how to use OglModel.

Key points

Clear the scene graph.

We will start by setting up a simple scene.

Add two GNodes to the root node. Name one "DragonVisu" and the other "TexturedSofaVisu".

Add an OglModel to each of the two new nodes. Name them "dragon" and "sofa".

Change the Path to the model in dragon to /Sofa/share/mesh/dragon.obj and the Path to the model in sofa to /Sofa/share/mesh/canapVM.obj.

Run in SOFA

The model is now correctly loaded and rendered; but we want to customize it.

Different kinds of parameters are offered through OglModel :

- Transformation : rotation, translation and scale, each as a vector of 3 floats
- Materials : describes ambient, diffuse, specular, emissive and shininess components. This is loaded either in a .MTL file attached to the OBJ; or as a string with the field material. You can also use the color field, which will fill the material fields accordingly.
- Texture : basic texture mapping with texturename field

In the properties for dragon, change the Initial Translation of the object to (0 10 2), the Initial Rotation of the object to (90 0 0) and the Initial Scale of the object to (0.5 0.5 0.5).

In the Property 2/3 tab, change the Ambient property to (0 191 0 255) and the Diffuse property to (51 51 0 229). Check the Specular and the Shininess checkboxes. Set Specular to (204 204 204 255) and Shininess to 25.

Run in SOFA.

Now we have a green dragon lying on the sofa.

In the Property 2/3 tab of the sofa, set the Name of the Texture to /Sofa/share/textures/snakeskin.png using the file browser.

Run in SOFA.

Now our sofa has been customized as well.

### Next