Hi, gus.
I am using CG in my opengl program and ocur one strange problem. the model rendererd withing VertexProgram has some rotation around x-axis, if i set VertexProgram to NULL, thing goes well. Some one help me~?
this is my shader:
[b]float4x4 ModelViewProj : ModelViewProjection;
sampler2D mainTex;
float4 diffuseColor = { 0.5, 0.2, 0.3, 1 };
struct v2f {
float4 pos : POSITION;
float4 uv : TEXCOORD0;
};
v2f mainVS(float3 pos : POSITION, float4 uv : TEXCOORD0) {
v2f o = (v2f)0;
o.pos = mul(ModelViewProj, float4(pos.xyz, 1.0));
o.uv = uv;
return o;
}
float4 mainPS( v2f i ) : COLOR {
return tex2D( mainTex, i.uv.xy );
}
technique {
pass {
VertexProgram = compile vp40 mainVS();
FragmentProgram = compile fp40 mainPS();
}
pass {
LightingEnable = true;
LightEnable[0] = true;
LightPosition[0] = float4( -10, 10, 10, 1 );
LightAmbient[0] = float4( 0.1, 0.1, 0.1, 0.1 );
LightDiffuse[0] = (float4( 2 * diffuseColor.rgb, 1 ));
LightSpecular[0] = float4( 1, 1, 1, 1 );
MaterialShininess = 10.0f;
MaterialAmbient = float4( 1, 1, 1, 1 );
MaterialDiffuse = float4( 0.5, 0.5, 0.5, 0.5 );
MaterialSpecular = float4( 0.5, 0.5, 0.5, 0.5 );
}
}[/b][b][/b]