I searched this forum but found no satisfactory answer for my question of whether it is possible to write multiply shaders e.g. vertex shaders that get executed so for example vertex shader0, vertex shader 1, …
The second statement…
Yes I want to use this shader.
Originally posted by powerpad: Is there a simple way to query inside the shader whether a texture is applied for a vertex/ fragment or not?
Even if there were such a thing, it would definitely be more expensive than doing one or more texture lookups.
In this case, you should know that, because it’s enabled in the OpenGL state and you can generate another shader which doesn’t use this texture at all, and will be faster than silly IsEnabled test per fragment.
BTW, glEnable(GL_TEXTURE_2D) is completely useless with fragment programs, because this state is for texture units (e.g. there are 4) and fragment programs work on texture image units (e.g. 16) which are always accessible.
OpenGL should have a default texture objects for all units (though I haven’t tested that), which means you can always source something (black transparent probably) except if the texture you downloaded is inconsistent.
So what you ask for is futile.
If you don’t have the OpenGL state acessible in that place, like you write a lib with shaders and other peoples applications use this, rethink your interface.
glEnable/Disable(GL_TEXTURE_?D) is ignored as soon as you use a fragment shader. The textures that are used by the shader are implicitly enabled, the others are not…