GL_TEXTURE_3D in CG v1.4 vertex shader?

hi guys!

is it possible to do a tex3d(sampler3D, float3) call to access a 3d texture in a cg vertex shader?

the whitepaper from nvidia about using vertex textures only mentions the use of a 2d texture.
(http://developer.nvidia.com/object/using_vertex_textures.html)

thanks a lot!
chris

That same document contains this sentence:
“GeForce 6800 supports D3DFMT_R32F and D3DFMT_A32B32G32R32F texture
formats (2D, cubemap, volume) for vertex texturing.”
Give it a try.

ok thanks,
but when i want to use opengl, i can just use sampler2D… or?

Cg and GLSL both contain sampler3D types. There should be no difference using Cg, GLSL or ARB_vertex_program assembly interface to do a vertex texture lookup. Should just work on a board supporting GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS > 0.

yes, i know.
but i wanted to say, that i want to use opengl, not direct3d.
the sentence from the document, that you mentioned is related to directx, but not opengl.

cg and glsl, both contain sampler3d types, but in the vertex shader together with opengl only sampler2d could be used (stated in the document, but the last revision is from 2004, so i thought, there might be changes).

when i try sampler3d, i get no compilation error, but the rendering result turns black.

Originally posted by nitschke:
but in the vertex shader together with opengl only sampler2d could be used (stated in the document, but the last revision is from 2004, so i thought, there might be changes).

You mean the sentence Vertex textures are bound using the standard texture calls, using the GL_TEXTURE_2D texture targets.

I guess that goes for the given example.

when i try sampler3d, i get no compilation error, but the rendering result turns black.

Ok, does it work with a 2D map?
You’re sure everything else is setup correctly?
Filtering set to GL_NEAREST?
Add glGetError calls to debug.

Don’t use black glClearColor during debug to see if you rendered something black on black.

Simplest test would be to put the texture data into the gl_FrontColor in the vertex shader to see if it affects it.

Show the vertex shader, the texture setup and the view and geometry code.

thanks for your help.

but i switched my approach. now i am using 2d textures and map the 3d texture into on large 2d texture.
i have heard, that its faster to access 2d textures anyway, so i tried this method. and 2d textures definetely work with vertex shaders.