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?
Even if it wouldn’t, it shouldn’t crash but fall back to software rendering instead. If it’s crashing, it’s probably due to a wrong pointer/size/offset you’re feeding GL or Cg. Check your vertex arrays/VBOs (if you’re using them) and shader source uploading.
What do you mean by passing the texture makes it crash?
If you call glTexImage2D and it crashes, then most likely the problem is your code.
Also, you have Cg code. To what profile are you compiling to? ARB_vertex_program or GLSL?
Ok but how to I force the application to use another profile?
When I inserted my old GF 7600 GS it automatically changed to VP40 and FP40 (which worked) so it seems that the application that I am using automatically uses the best found profile.