If I change to DirectX9 or 10 only a red wireframe mesh shows up, both in the material preview and in the perspective view.. CG is cross platform, but what about CgFX? Do I need a .fx file for rendering cg shaders in directx? If so, would I need that in my application aswell?
void mainVS(float4 position : POSITION,
float3 normal : NORMAL,
float2 texCoord : TEXCOORD0,
out float4 oPosition : POSITION,
out float2 oTexCoord : TEXCOORD0,
uniform float4x4 viewProjection,
uniform float4x4 world)
{
oPosition = mul(world, position);
oPosition = mul(viewProjection, oPosition);
oTexCoord = texCoord;
}
void mainFS(float2 texCoord : TEXCOORD0,
out float4 color : COLOR,
uniform sampler2D colorSampler)
{
color = tex2D(colorSampler, texCoord);
}
float4x4 world : World;
float4x4 viewProjection : ViewProjection;
texture colorTexture <
string ResourceName = "default_color.dds";
string UIName = "Diffuse Texture";
string ResourceType = "2D";
>;
sampler2D colorSampler = sampler_state {
Texture = <colorTexture>;
generateMipMap = true;
MinFilter = LinearMipMapLinear;
MagFilter = Linear;
WrapS = Repeat;
WrapT = Repeat;
};
technique basic_textured_dx_40
{
pass
{
FragmentProgram = compile ps_2_0 mainFS(colorSampler);
VertexProgram = compile vs_2_0 mainVS(viewProjection, world);
DepthTestEnable = true;
DepthMask = true;
}
}
technique basic_textured_ogl_40
{
pass
{
FragmentProgram = compile fp40 mainFS(colorSampler);
VertexProgram = compile vp40 mainVS(viewProjection, world);
DepthTestEnable = true;
DepthMask = true;
}
}