Rendering a simple colored triangle using shaders
We will now put the GLSLShader
class to use by implementing an application to render a simple colored triangle on screen.
Getting ready
For this recipe, we assume that the reader has created a new empty Win32 project with OpenGL 3.3 core profile as shown in the first recipe. The code for this recipe is in the Chapter1/SimpleTriangle
directory.
Tip
In all of the code samples in this book, you will see a macro GL_CHECK_ERRORS
dispersed throughout. This macro checks the current error bit for any error which might be raised by passing invalid arguments to an OpenGL function, or when there is some problem with the OpenGL state machine. For any such error, this macro traps it and generates a debug assertion ...
Get OpenGL – Build high performance graphics 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.