Access Violation Exception with glfwSwapBuffers

Hello everyone,
I’m new with Open GL and GLFW and I’m following some tutorials to get started and I’ve got a weird issue.

As the title say, I get a Access Violation Exception on glfwSwapBuffers call.

OS: Windows 10
IDE: Visual Studio 2015 Community Edition
Libraries : GLEW 1.13, GLFW 3.2, GLM (not used anyway)

The issue occures in this class:
https://github.com/Nokorbis/attila-s-quest/blob/35adeee903318b6f493ea1664343be4506af5f7d/Attila/src/Game.cpp#L44

Interresting fact:
If we comment the glVertexAttribPointer() and the glDrawArrays() (line 50 -> 59), the issue does not occures.

and there is this class for information:
https://github.com/Nokorbis/attila-s-quest/blob/35adeee903318b6f493ea1664343be4506af5f7d/Attila/src/graphics/Window.cpp#L76

This is the glfwSwapBuffers(_window) [line 76] that make the crash

Any idea is appreciated.

Thanks to everyone :slight_smile:

Have you tried to use glVertexPointer instead of glVertexAttribPointer? Afaik glVertexAttribPointer makes sense only if you use GLSL shaders where you can specify vertex attribute location or query it after linking.

glVertexPointer(3, GL_FLOAT, 0, (void*)0);

Just tried and still have the same error

Oops, forgot to mention that you also need to replace glEnableVertexAttribArray(0) with glEnableClientState(GL_VERTEX_ARRAY)

Hey ! It doesn’t crash anymore ! Thank you !

But I don’t have any white triangle displayed x). Might it be a black triangle ?


Solved