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
enumclass 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
Drawfunction. There are two overloads for theDrawfunction—one takes an index buffer and a draw mode...