Original Post
Hi, I'm trying to get Cg working in my app using code from sample:
context = cgCreateContext();
if (vertexProfile == CG_PROFILE_UNKNOWN || fragmentProfile == CG_PROFILE_UNKNOWN) {
vertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
fragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
}
cgGLSetOptimalOptions(vertexProfile);
cgGLSetOptimalOptions(fragmentProfile);
cgGLEnableProfile(vertexProfile);
cgGLEnableProfile(fragmentProfile);
vertexProg = cgCreateProgramFromFile(context,
CG_SOURCE,
"c:\\Vertex.cg",//"BlinnVertex.cg",
vertexProfile,
"main",
NULL);
The shader compiles fine with cgc, but when I use
error = cgGetFirstError();
const char* error_text = cgGetErrorString(error);
to figure out why shader doesn't work, I get the following: "CG ERROR : Invalid program handle." Where can be the problem and why my program handle could be invalid? Sample, from which I got this code compiles and runs fine. Thanks for everything that can help, Peter.