Writing a Vertex Shader

Before you write your first vertex shader program, you need something to render other than the blank screen that currently is displayed after you click one of the new game type buttons. Your first object rendered with the programmable pipeline might as well be the go-kart because that will be the focus of the game. Add the following variables to your class now:

// Kart mesh
private Mesh kartMesh = null;
private Texture[] kartTextures = null;

You've been using meshes and textures throughout this book, so this code shouldn't be that surprising. You might have noticed that the materials you normally create when you load the mesh are nonexistent, though. The materials are used by the fixed-function pipeline to determine ...

Get Beginning 3D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.