Making changes to the draw triangle code

As we created our shader files and the Shader.h header file in the preceding sections, we'll now load those files into our triangle code. To do this, we'll have to make certain changes to the triangle code that we wrote earlier. Check out the below mentioned steps:

  1. We'll begin by including the Shader.h header file, because without that we can't actually use the Shader class:
#include "Shader.h"
  1. Then, before defining our vertices, we'll add the following line of highlighted code:
// Build and compile our shader program Shader ourShader( "core.vs", "core.frag" );
For Xcode, this highlighted code will be replaced with the following line of code: Shader ourShader( "resources/shaders/core.vs", "resources/shaders/core.frag" ...

Get Learn OpenGL 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.