tags:

views:

329

answers:

1

I'm trying to find like NeHe's tutorials for Qt that are all in GLSL. Because lets face it, OpenGL in the old days are dead and Shaders are the only way now. And with Qt-4.6 they introduced the QMatrix4x4, QVector3, and the Shader classes. But I cannot find any tutorials for this.

All the ones I do find, all use crappy SDL and/or GLUT (Which are just plain useless).

+1  A: 

Porting OpenGL code between languages and GUI frameworks shouldn't change the code much. When moving from GLUT to Qt, for example, you move GLUT's reshape code into the QGLWidget's resizeGL function and GLUT's display function into QGLWidget's paintGL function. That's the biggest change going from GLUT to Qt besides the setup stuff.

Besides that, everything is pretty much tacked on as little bonus utilities and classes. You basically have to look for a class when you need it. Like "I'm going to use a shader, so let's see if Qt has any helper classes". You find a class called QGLShader, which seems to help, but it doesn't have any documentation, so you should try another class that might have documentation like QGLShaderProgram.

http://doc.trolltech.com/4.6/qglshaderprogram.html#details

Jumping down to the details it gives you an example/tutorial of how to use it and the QGLShader class.

For smaller classes like vectors and matrices, you have to just read their function documentation, which is simple enough. Vectors, for instance, have a QVector3 class. I can look at it's class page and see it has the normal functionality I would expect in a vector class like normalizing, adding, etc. A tutorial on something this simple wouldn't really help me.

In my experience, this is the standard way to go about using wrappers in OpenGL. In JOGL, for instance, there's a large Texture class, which is helpful for texture io. When I needed to add textures, I found it just by searching for "texture" in the javadoc.

voodoogiant