Texture acces from Vertex Shader for displacement

Hi,

i am trying to read a vector from a texture texel to add it to the current vertex position.

Maybe the problem is that i use typical GL_RGBA 1D texture in the creation:

glTexImage1D(GL_TEXTURE_1D,0, GL_RGB, width, 0,GL_RGB, GL_UNSIGNED_BYTE,(GLvoid *)image );

I show the code of the vertex program down:

void main()
{
vec4 trans = texture2D(tex0, vec2(0.0, 0.0));
vec4 v = gl_Vertex;

//if i comment this line it goes 30 fps
//with it uncommented it goes 4 fps
v.x += trans.x;

gl_Position = gl_ModelViewProjectionMatrix * v;
}

Maybe should i use some extension to load floats into the texture ? Is it true that you cannot acess 1D samplers in vertex program, only 2D ??

Thank you,
Marcos.

In NVIDIA Opengl 2.0 support document stands that you can acess 1D and 2D samplers, but cant 3D,cube, rectangle. Ofcourse you have to use float textures in Vertex shaders.

Now I’ll have to handle those float textures

Thanks a lot,
Marcos

Texture fetch in a vertex shader is currently hardware accelerated only with 2D textures with internal formats of type float32.
Pick one of the following supported formats:

  GL_LUMINANCE32F_ARB 0x8818
  GL_RGBA32F_ARB      0x8814

I have read official NVIDIA release notes for 77.72 WHQL drivers, so I dedicated from this that WHAT IS TOLD IN NVIDIA DOCUMENT IS VALID, but now I dont trust to this people in nvidia, who wrote this document and I am very dissapointed of NVIDIA :frowning:

Dude give us a break, we work hard to meet most of your demands. :frowning:
PS: you can read more about our vertex shader 3.0 support right here

Matt, I’m pretty sure 1D vertex textures are supported in hardware too. I searched some posts I made on NVIDIA’s devrel forum where I came to the conclusion that they were hardware accelerated based on some tests I’d done (different computer so I can’t check right now). Anyway, even if they’re not, you could just use NPOT textures sized n * 1. NPOT vertex textures work fine (but not ARB_tex_rects).

thanks ffish for rising my mood :wink:

Originally posted by ffish:
Matt, I’m pretty sure 1D vertex textures are supported in hardware too. I searched some posts I made on NVIDIA’s devrel forum where I came to the conclusion that they were hardware accelerated based on some tests I’d done (different computer so I can’t check right now). Anyway, even if they’re not, you could just use NPOT textures sized n * 1. NPOT vertex textures work fine (but not ARB_tex_rects).
Why use a NPOT texture of n * 1?
It’s perfectly valid to create a 2D texture n *1 where n is a power of 2 number.

Good point. I’m just used to using NPOT for my work so that was what immediately sprang to mind.

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