View Full Version : Cg profile problem!
06-06-2005, 04:23 PM
Please help! Cg is driving me a bit nuts. I have got all the libraries linked in, and the various bits of setup code implemented (I am using OpenGL with BCB). Firstly I could only get Cg to detect the best profile if I called cgGLGetLatestProfile before initialising OpenGL. That didn't make any sense to me. I finally managed to get it to return CG_PROFILE_FP30 (I am using an FX 5600). But then when I tried to compile my program in runtime the compiler returned CG_INVALID_PROFILE_ERROR! How can this be? What am I doing wrong? Why doesn't nVidia have a Cg forum!?
Thanks in advance,
06-07-2005, 08:46 AM
Can you post what you're doing in your init routines? When you say you're getting the profile before intializing OpenGL, what exactly do you mean?
you could try the forums at opengl.org, gamedev.net or flipcode.com too
06-07-2005, 11:14 AM
Sure thing, heres the code!
Heres my base initialisation:
if(!ofsbuffer.Initialise(width, height, handle))
m_cgcContext = cgCreateContext();
if(m_cgcContext == NULL)
m_cgpBestFragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
//CGprofile BestVertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
if(m_cgpBestFragmentProfile == CG_PROFILE_UNKNOWN)
The next bit is the bit that fails:
ofsbuffer.Initialise() just does standard OpenGL initalisation of an offscreen buffer using the DC of a bitmap.
LoadProgram() looks like:
bool LoadProgram(CGprogram &prog, std::string funcname, std::string name)
// cgGLEnableProfile(m_cgpBestFragmentProfile); <- tried that aswell
prog = cgCreateProgramFromFile(m_cgcContext,
CGerror error = cgGetError();
if(error != CG_NO_ERROR)
06-07-2005, 11:56 AM
Okay so I have found a bit of insight into this problem: turns out the initialisation of OpenGL is important to whether the shaders can be supported. If the Pixelformat forces OpenGL to fall back on software then the shaders cannot be used. So I fixed it so that the correct profile can now be detected, and it is, but the program will not LOAD now. Says CG_PROFILE_NOT_SUPPORTED even though its own routine just said it was!! I mean wtf.
06-07-2005, 11:56 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.