View Full Version : GL_POINTS, texture3D and vertex shader
03-05-2007, 06:51 AM
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 :)
03-05-2007, 12:06 PM
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
-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.
03-05-2007, 11:10 PM
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!
03-06-2007, 02:32 AM
Any particular reason you're doing this in the vertex shader and not the fragment shader? That would be a lot more generic.
03-06-2007, 03:15 AM
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)?
03-06-2007, 06:43 AM
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.
03-06-2007, 11:50 PM
Thanks for the help. The first step is made! I can actually see the texture on my point grid now.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.