Calling glfw methods in C++ class methods

Dear GLFW community,

I am working on a small project using GLFW. I wanted to simplify the rendering process for myself, and be able to construct a “rendering object” in a seperate c++ class, which is then called by the main render function. Quite simply, I construct an instance of this class, where I pass in vertex and indices data. Using this, I call a method on the object updateData(), which makes all relevant gl commands to render. Finally, I call render() on the object in the main rendering loop, which just contains the code needed in the rendering loop.

If I unfold all this class stuff and simply put it in my main render.cpp, it works. When wrapped in a class abstraction, the same exact commands cease to work. It seems that the actual underlying data is still there in the rendering loop, so it does not seem to be a pointer / data issue.

Hope my description of the problem is somewhat clear… What could be going wrong here?

This sounds more like a general C++ or OpenGL issue than a GLFW one, however the description of what you are doing and what issue you are experiencing is too abstract to be of help.

I suspect you will find that when you step through the code in a debugger you are doing something different in one case than in the other. Since you have been able to get this to work without the class abstraction you should therefore be able to replicate this program flow with the abstraction.