Loading geometry (TVM)
In this tutorial you’ll see how you can load a geometry made in for example 3D Max. This is a quite important tutorial, since you won’t make use of the normal cubes and spheres a lot when you’re trying to make a game. We will still load a kind of cube, but this one will have rounded edges.

What do we need?
- We need a 3D model, which is in our common folder now. It’s been converted/exported to a *.tvm file. A tvm file is a native file of TV, so that’ll work pretty good in most cases. I won’t go in depth about how to work with the exporter or the converter, but that should be pretty easy.
- What we don’t need anymore is the integer to keep track of the normal and the regular texture, since the model contains the paths already.
How do we set things up?
- First we need to delete the loading of the normal and general texture, because we’re not using either of them.
- Now we need to load the model instead of making a cube. This is done by the following call:
The first parameter is the path of the model we’re loading, the second one is a boolean that specifies if the textures should be loaded (we want to do that right now, so that one is true). The third parameter specifies whether the materials should be loaded as well. In this case it’s true, but we don’t really need it, because we’re applying an other material to it anyway.
- We set the lightingmode to bumpmapping/tangentspace because there’s a normal texture specified in the model.
How do we render this?
- We render everything exactly the same as last 2 tutorials. This is convenient, there’s no change of rendering needed when you’re loading an other object than the one you had before.
Things you can add/change yourself
- Try loading other .tvm files from the common folder. We’ll use those tvm files later on as well to make a room etc.
- Try applying the general and normal map to the tvm file we loaded. This is good to do, since you’ll be able to test if you understood the previous 2 samples.