I have written tiny OpenGL engine which uses 3+ functions. I am currently trying to integrate my engine in QGLWidget and have problems. When rendering obj model without qt framework I have got expected results, but when using Qt my OpenGL buffers are corrupted in some way so that I see wrong result or even nothing.
Without Qt:
In QGLWidget:
I want to ask whether Qt changes any OpenGL states between QGLWidget::paintGL() calls. My objects are initialized and rendered in the following order:
Initialization:
Create and bind vertex array
Create and bind vertex buffer
Fill vertex buffer (works fine - obj loader tested many times)
Calls to glVertexAttribPointer() and glEnableVertexAttribArray()
Rendering:
Bind vertex array
Shaders, uniforms, etc.
glDraw*()
The issue you are seeing is because Qt is setting the C locale on your system for you, to something that is expecting floats to be comma delimited instead of period delimited.
You can work around it by resetting the local to something else immediately after you invoke QApplication
For example:
std::setlocale(LC_ALL, "POSIX");