cgGetErrorString says: "Invalid technique handle."
If I run the cgfx file through cgc specifying fp40 and vp40 which is the profiles of the basic_textured_ogl_40 technique I get 0 errors..
This is the code that loads the technique..
m_cgEffect = cgCreateEffect(cgContext, data, NULL);
m_cgTechnique = cgGetFirstTechnique(m_cgEffect);
while (m_cgEffect && cgValidateTechnique(m_cgTechnique) == CG_FALSE)
{
std::cout << "Technique " << cgGetTechniqueName(m_cgTechnique) << " did not validate" << std::endl;
m_cgTechnique = cgGetNextTechnique(m_cgTechnique);
}
if (!m_cgTechnique)
{
std::clog << "Your GPU does not support any of the techniques available" << std::endl;
exit(1);
}
The cgfx file:
void mainVS(float4 position : ATTR0,
float3 normal : ATTR2,
float2 texCoord : ATTR8,
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 texSampler0)
{
color = tex2D(texSampler0, texCoord);
}
float4x4 world : World;
float4x4 viewProjection : ViewProjection;
sampler2D texSampler0 = sampler_state {
generateMipMap = true;
MinFilter = LinearMipMapLinear;
MagFilter = Linear;
WrapS = Repeat;
WrapT = Repeat;
};
technique basic_textured_dx_40
{
pass
{
FragmentProgram = compile ps_4_0 mainFS(texSampler0);
VertexProgram = compile vs_4_0 mainVS(viewProjection, world);
DepthTestEnable = true;
DepthMask = true;
}
}
technique basic_textured_ogl_40
{
pass
{
FragmentProgram = compile fp40 mainFS(texSampler0);
VertexProgram = compile vp40 mainVS(viewProjection, world);
DepthTestEnable = true;
DepthMask = true;
}
}