GL_POINTS, texture3D and vertex shader

Hi there,

Here’s what I’d like to do, maybe someone can help me out.

  1. I have a 3D texture loaded in texture memory.
  2. I have a grid of vertices rendered as GL_POINTS
  3. In a vertex shader I want to load texels at the
    right texture coordinate to change the
    vertex/point color in the shader.

For one thing I can not change gl_FrontColor in the vertex shader as soon as I enable my 3D texture. Furthermore I can’t seem to fetch the correct texel (or actually voxel) from my 3D texture.

Anyone any suggestions? Thanks in advance :slight_smile:

Texture access from vertex shader is hardware accelerated only if:
-GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS > 0
-texture is 1D or 2D
-texture has FLOAT32 format
-texture has no border texels

Also:
-the bias parameter is not accepted in a vertex shader
-if a mipmapped texture is accessed from a vertex shader, the base texture is used.

These restrictions are true for GeForce 6 and 7.
GeForce 8 has unified shader architecture.

No Radeon currently available can do that. The upcoming GPU from ATI surely will.

So, if you want hardware acceletration and copatibility with current ATI GPU’s you have no alternative but to use ARB_pixel_buffer_object.

Thanks for your reply,

Luckily I have a GeForce 8800 to use, so the restrictions aren’t a problem.

I’ll continue with my code. Other suggestions are still welcome!

Any particular reason you’re doing this in the vertex shader and not the fragment shader? That would be a lot more generic.

The texture data represents a volume, which I would like to traverse. (Somewhat like a marching cubes algorithm)

I’ve discovered that the vertex shader does not automatically calculate LOD, so I have to use texture3DLod for the lookup.

Can someone tell me if I can apply a texel to each vertex in the vertex shader? Does enabling the texture disable color mode (setting gl_FrontFace)?

Does enabling the texture…
Actually, shaders replace fixed functionality so you don’t have to enable texture - just bind it. For the same reason your vertex shader must pass color and texture coordinates to fragment shader if it uses these.

Thanks for the help. The first step is made! I can actually see the texture on my point grid now.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.