View Full Version : Texture acces from Vertex Shader for displacement
06-28-2005, 08:17 AM
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:
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 ??
06-28-2005, 09:44 AM
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.
06-29-2005, 02:03 AM
Now I'll have to handle those float textures
Thanks a lot,
Java Cool Dude
06-29-2005, 08:27 AM
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:
06-29-2005, 11:35 AM
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 :(
Java Cool Dude
06-29-2005, 11:26 PM
Dude give us a break, we work hard to meet most of your demands. :(
PS: you can read more about our vertex shader 3.0 support right here (http://developer.nvidia.com/object/using_vertex_textures.html)
06-30-2005, 08:29 PM
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).
07-02-2005, 06:11 AM
thanks ffish for rising my mood ;)
07-02-2005, 02:20 PM
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.
07-03-2005, 05:03 PM
Good point. I'm just used to using NPOT for my work so that was what immediately sprang to mind.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.