OpenGL shader functions not working
-
wrote on 10 Mar 2015, 07:44 last edited by
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!
-
wrote on 10 Mar 2015, 08:16 last edited by
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 :-)
wrote on 10 Mar 2015, 09:06 last edited by@Wieland
Thanks ill check it out!
-
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 :-)
wrote on 10 Mar 2015, 09:10 last edited by Jordan69 3 Oct 2015, 09:11@Wieland
Ok I got a question, with QOpenGLShaderProgram, all I have to do is add the header right?
-
@Wieland
Ok I got a question, with QOpenGLShaderProgram, all I have to do is add the header right?
wrote on 10 Mar 2015, 10:09 last edited by@Jordan69 Yes:
#include <QtGui/QOpenGLShaderProgram>
-
@Jordan69 Yes:
#include <QtGui/QOpenGLShaderProgram>
wrote on 10 Mar 2015, 11:17 last edited by@Wieland
Thank you so much Wieland.
-
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 :-)
wrote on 11 Mar 2015, 09:28 last edited by@Wieland
Am I meant to put shaders in a specific function like initializeGL?
-
wrote on 11 Mar 2015, 19:22 last edited by
@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).
6/8