Rendering geometry
You have classes for dealing with vertex data, uniforms, and index buffers, but no code to draw any of it. Drawing will be handled by four global functions. You will have two Draw
functions and two DrawInstanced
functions. You will be able to draw geometry with or without an index buffer.
Create a new file, Draw.h
. You will be implementing the Draw
function in this file, as follows:
- Declare an
enum
class that defines what primitive should be used for drawing. Most of the time, you will only need lines, points, or triangles, but some additional types may be useful:enum class DrawMode { Points, LineStrip, LineLoop, Lines, Triangles, TriangleStrip, TriangleFan };
- Next, declare the
Draw
function. There are two overloads for theDraw
function—one takes an index buffer and a draw mode...