O'Reilly logo

Beginning 3D Game Programming by Tom Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Rendering a Track and Multiple Go-Karts

Before you can do any of those things, first you need something interesting to be rendered. You currently have a single go-kart being rendered, which is all well and good, but it doesn't give you much opportunity to see anything if you render a scene into your texture. To change this situation, first you should set up your code to create and render multiple go-karts.

Find the declaration to your go-kart variables for the mesh and textures and replace them with these:

// Kart mesh
private const int NumberKarts = 5;
private Mesh[] kartMeshes = null;
private Texture[][] kartTextures = null;

// Track mesh
private Mesh trackMesh = null;
private Texture[] trackTextures = null;

Along with creating an array of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required