OpenGL shader functions not working
-
Hi, i am using Qt version 5.4.1. My gpu can support OpenGL version 4.2 but functions such as glCreateShader or glCompileShader etc. do not work. Other functions such as glGenBuffers work perfectly fine. I am using QOpenGLFunctions and i have called initializeOpenGLFunctions in my initializeGL() function. I am very sorry if this is a noob question as i am new to Qt and OpenGL. Thanks!
-
Hi Jordan69!
There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html
Hope that helps :-)
-
Hi Jordan69!
There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html
Hope that helps :-)
-
Hi Jordan69!
There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html
Hope that helps :-)
-
@Wieland
Ok I got a question, with QOpenGLShaderProgram, all I have to do is add the header right?
@Jordan69 Yes:
#include <QtGui/QOpenGLShaderProgram>
-
@Jordan69 Yes:
#include <QtGui/QOpenGLShaderProgram>
-
Hi Jordan69!
There is an example in the docs that shows how to use QOpenGLShaderProgram: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html
Hope that helps :-)
-
@Jordan69 No, you can compile your shaders and link them whenever you need them. But keep in mind that your shaders are compiled by the GPU at runtime. So, compilation takes time and you can't afford to do this everytime you render a single frame. Thus it's wise to have some init function that is called only on startup or when you need to make changes to your shader program(s).