mosen
11-26-2008, 10:55 AM
I am currently writing a vertex program in Cg that makes a lookup in a texture which looks something like this:
struct vertex_input
{
float4 position : POSITION;
float4 normal : NORMAL;
float2 uv : TEXCOORD0;
};
struct vertex_output
{
float4 position : POSITION;
float tex1 : TEXCOORD1;
};
vertex_output main(
vertex_input IN
, uniform float4x4 ModelViewProj
, uniform float du
, uniform float dv
, uniform sampler2D heightMap
)
{
vertex_output OUT;
// Get value from heightmap.
float h = tex2D(heightMap, IN.uv);
float4 new_pos = IN.position + IN.normal*h;
// Transfer displaced position to clip-space.
OUT.position = mul(ModelViewProj, new_pos);
OUT.tex1 = h;
return OUT;
}
But even passing the texture makes the program crash! I have tried to put my old GF7600 in the machine and it works fine. Is it really a fact that ATI 4850 still does not support vertex texture fetching?
struct vertex_input
{
float4 position : POSITION;
float4 normal : NORMAL;
float2 uv : TEXCOORD0;
};
struct vertex_output
{
float4 position : POSITION;
float tex1 : TEXCOORD1;
};
vertex_output main(
vertex_input IN
, uniform float4x4 ModelViewProj
, uniform float du
, uniform float dv
, uniform sampler2D heightMap
)
{
vertex_output OUT;
// Get value from heightmap.
float h = tex2D(heightMap, IN.uv);
float4 new_pos = IN.position + IN.normal*h;
// Transfer displaced position to clip-space.
OUT.position = mul(ModelViewProj, new_pos);
OUT.tex1 = h;
return OUT;
}
But even passing the texture makes the program crash! I have tried to put my old GF7600 in the machine and it works fine. Is it really a fact that ATI 4850 still does not support vertex texture fetching?