Exception thrown at 0x00000000 in OpenGL.exe: 0xC0000005: Access violation reading location 0x00000000

-1

i can't find this problem in stack overflow this is a opengl project using glue and glfw with c++ and the code is form https://www.glfw.org/documentation.html. I just want to make triangle with buffer. #TIA

#include <GL/glew.h>
#include <GLFW/glfw3.h>
float positions[6] =
{
    -0.5f, -0.5f,
     0.0f,  0.0f,
     0.5f, -0.5f,
};
unsigned int buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), positions, GL_STATIC_DRAW);

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

    glDrawArrays(GL_TRIANGLES, 0, 3);
    
    /* Swap front and back buffers */
    glfwSwapBuffers(window);

    /* Poll for and process events */
    glfwPollEvents();
}
c++
opengl
glfw
asked on Stack Overflow Oct 14, 2020 by wasifbinlatif

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0