Texture sampler in vertex shader?

Hi! I’m trying to find out if I can reliably use a texture sampler in my vertex shader or not.

According to the GLSL 1.20 specification, §8.7: “Texture lookup functions are available to both vertex and fragment shaders.”

Is this true for earlier versions of the spec, and is it true for all hardware that support GLSL?

is it true for all hardware that support GLSL?

No.

Then, is there a way to know which HW does support texture lookup in the vertex shader? Runtime? Is there a list (e.g. at NVIDIA) for different models?

From what I’ve learned in these forums, it is up to you to test on the widest possible variety of cards.

The GeForce 6 has limited support for vertex texture fetch, see NVIDIA’s Using Vertex Textures. I believe the GeForce 8 has full support for vertex textures, given its unified shader architecture. One exception is computing mipmap LODs, which is only available in fragment shaders.

Regards,
Patrick

Thanks pjcozzi,

The NVIDIA document mentions that checking for NV_vertex_program3 is the thing. But that is NVIDIA only, I suppose, so not really a good thing to do.

Perhaps the best thing is to try to compile a vertex shader that uses vertex texturing, and see if it compiles?

I found this wiki-page very useful:

http://www.opengl.org/wiki/Vertex_Texture_Fetch