Step 10 Call triangle functions in main()
Call triangle functions
// loading glad
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std::cout << "Couuldn't load opengl" << std::endl;
glfwTerminate();
return -1;
}
initTriangle();
// setting the background colour, you can change the value
glClearColor(0.25f, 0.5f, 0.75f, 1.0f);
// setting the event loop
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
glClear(GL_COLOR_BUFFER_BIT);
drawTriangle();
glfwSwapBuffers(window);
}
glfwTerminate();Final result

Last updated