PDA

View Full Version : GLSL shaders, multitexturing and Qt



jcox23
20th January 2010, 19:37
The amount of documentation and literature around about the use of shaders in qt4 is a bit thin... (please prove me wrong!)

Some questions are not really directly Qt-related, but I'll give it a shot...

With Qt versions pre 4.6, I havent manage do to something useful, I'm having segfaults when calling glCreateShaderObjectARB...
and I haven't got the singlest clue of what's going on.. maybe i'll do a separate topic for this one...

The Qt 4.6 has the QGLShader/QGLShaderProgram... brillant stuff...
I was able to use the usual basic texturing shaders in a QGLWidget...

But I need to go a bit further...I would need to use 2 textures in a shaders (a texture lookup of a texture lookup)...
I was confused for a while because I thought that one just need to pass the texture id of the different textures into uniform samplers,
but a texture unit number you should pass right?

So if I want to do multi texturing, I need to put each textures into a separate texture unit right?

That brings 2 others questions:
- I was under the impression that texture units are not that numerous onto graphic cards these days (4 to 8)
does that mean you cannot use a larger number of textures simultaneously?

- So I started using glActiveTexture to activate texture units and all...the compiler is saying that the name is unknown...
checking the Red Book...it says that multitexturing is not an extension anymore since v1.5 (i use the latest nvidia drivers on a QuadroFX3800)... when I check the Qt example "boxes", multitexturing is treated as an extension... how come? isn't that contradictory?

Finally, the recent blog posts from Qt Labs about performance worried me a bit....
having to display and browse through large amount of scientific data (few tens of millions of floats updated every few seconds)... I thought nothing could beat
OpenGL even though everything is actually 2D datasets...
but it seems that OpenGL performance isnt' really that greater compared to other methods...
since I have to do a lot zooming around in the dataset, rotation, color changing, I still think OpenGL is the way to go (at least the Cpu is releaved of these tasks) but I'm not so sure anymore... any thoughts on this? would you have chosen the OpenGL road (compared to other Qt solution I mean)?

thx, I hope I'm not too Off Topic...