Exception thrown at 0x796C2D11 (ig9icd32.dll) in openGL.exe: 0xC0000005: Access violation reading location 0x012D5408. occurred

0

I'm trying to draw a triangle in openGL. I'm following a tutorial, but the triangle is not showing up and I am getting the exception written in the title. Can any explain why? Here is my code:

#include <GLFW/glfw3.h>

int main(void)
{
 GLFWwindow* window;

 /* Initialize the library */
 if (!glfwInit())
     return -1;

 /* Create a windowed mode window and its OpenGL context */
 window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
 if (!window)
 {
     glfwTerminate();
     return -1;
 }

 /* Make the window's context current */
 glfwMakeContextCurrent(window);

 /* Loop until the user closes the window */
 while (!glfwWindowShouldClose(window))
 {
     /* Render here */
     glClear(GL_COLOR_BUFFER_BIT);

     glBegin(GL_TRIANGLES);
     glVertex2f(-0.5f, -0.5f);
     glVertex2f(0.0f, 0.5f);
     glVertex2f(0.5f, -0.5f);

     /* Swap front and back buffers */
     glfwSwapBuffers(window);

     /* Poll for and process events */
     glfwPollEvents();
 }

 glfwTerminate();
 return 0;
}
c++
opengl
graphics
glfw
asked on Stack Overflow Jul 10, 2020 by Reean

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0