QOpenGLFunctions_4_5_Core static variables
-
Having a
static QOpenGLFunctions_4_5_Core * GL;
struct Viewport : QOpenGLWindow, protected QOpenGLFunctions_4_5_Core {
Viewport() {
GL = this;
}
}and maintaining a reference to
attempting to assign anything to a static GLuint fails / goes out of scope.
eg. creating a shader program or a VAO / VBO to a static variable the data is deleted instanly after being assigned.The purpose is to have many classes that each render a different kind of primitive but managing context is confusing and each class instance should use the same shaderprogram. is there a way to maintain OpenGL variables inside static variables?
-
@Pekoyo said in QOpenGLFunctions_4_5_Core static variables:
is there a way to maintain OpenGL variables inside static variables?
You should rather use a common base class for all these classes where you put that GLuint variable.
From your description it is also not clear how you're using that static variable.