Am 23.07.2014 um 19:06 schrieb Martin Ertl <qsmokeonthewa...@gmail.com>:

> ...
> 
> Question:
> Where is my mistake?
> Does the call of "bind()" on the second texture overwrite the "bind()" from 
> the first texture?

Yes :)

> ... which has a method "glActiveTexture()"

This. I can only speak for "raw OpenGL" right now, but OpenGL has several 
"texture units" (a minimum of 16 per shader stage). One of them is the "active" 
unit.

As long as you deal only with one texture you don't need to worry about setting 
the "active texture (unit)": by default the "active texture selector is 0".

For multiple textures you iterate over all involved textures and "activate" the 
corresponding texture units (glActivateTexture) before "binding" 
(glBindTexture) the texture.

Additionally you need to specify to which texture unit a given "uniform 
sampler2D tex1" refers to by calling glUniform1i and setting the "texture 
selector" (values 0, 1, 2,  ... Max Texure Units).

In recent (OpenGL >= 4.1?) shader versions there is also a "layout" (or 
"location") qualifier, so you can save the call to glUniform1i - but the exact 
syntax escapes me right now.

Lookup any "multi texture" example on the web, and the above will become clear 
;)

How to apply this to the usage of the mentioned Qt classes is left as an 
exercise to the reader...

Cheers,
  Oliver
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to