I am trying to learn OpenGL with GLFW/glBinding and I if i want to create and use a vertexbuffer, I get the Compilingerror
error: cannot convert ‘int’ to ‘gl::GLenum’ for argument ‘1’ to ‘void gl::glBindBuffer(gl::GLenum, gl::GLuint)’
gl::glBindBuffer(GL_ARRAY_BUFFER, VBO);
My IDE (Clion) tells me, that there is a param mismatch (obviously) after a Macro substitution. So my Question is: what did I wrong? Because if it was the macros fault, there would be more hits on google for this topic :)
Code:
GLuint VBO;
gl::glGenBuffers(1, &VBO);
gl::glBindBuffer(GL_ARRAY_BUFFER, VBO);
My Tutorial is this and it it says not to use the namespace gl:: but if I don't I can't access the functions, so i guess this is not the problem.
thanks
First step: according to glBinding's documentation, the argument should be something like
gl::GL_ARRAY_BUFFER
. Still, this won't solve the whole problem.This is because your OpenGL implementation used
#define
's to expose constants such asGL_ARRAY_BUFFER
, in the following manner:This means that your code is actually preprocessed to:
And that, before the compiler has had a chance to see your code and use glBinding's
GL_ARRAY_BUFFER
. Hence the error.The solution is, as stated in the documentation, to remove and replace the standard
GL.h
include with the include from glBinding.