Need help, cgGLIsProfileSupported() always returns false

Hey everyone,
I’ve been trying to have a Cg program compiled in a windows .dll program.
When I call CgGL.cgGLIsProfileSupported(), whatever the profile I give it, it returns false.
I have a Geforce 6800 vid card,and I have installed my vid card and downloaded the latest version of Cg SDK 1.41 from nvidia site.
code like this:
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
if(g_hInstance == NULL)
return 1; // ok
void InitCG()
// Search for a valid vertex shader profile in this order:
// CG_PROFILE_ARBVP1 - GL_ARB_vertex_program
// CG_PROFILE_VP40 - GL_ARB_vertex_program + GL_NV_vertex_program3

if( cgGLIsProfileSupported(CG_PROFILE_ARBVP1) )
    g_CGprofile_vertex = CG_PROFILE_ARBVP1;
else if( cgGLIsProfileSupported(CG_PROFILE_VP40) )
    g_CGprofile_vertex = CG_PROFILE_VP40;
	//g_CGprofile_vertex = cgGLGetLatestProfile(CG_GL_VERTEX);
   AfxMessageBox( "Vertex Shader hardware init failed.",MB_OK );
   // return;


Don’t you need to call cgCreateContext() first?
I’m not sure if you need to create an OpenGL context as well before you can query supported OpenGL profiles.

Be careful with the initialization of other DLLs from within DLLMain. Read the remarks in this manual page:

I have this game called solder of fortune,wen I try to play it I get A pop up saying could not initialise opengl rendering inviroment,and(GLSetup)is recommended. I have tryed and tryed but I cant find it or do I have A clue what it is.I have windows 2000 and my vidio card is 3dfx interactive inc voodoo3.Can someone please help me ? Thank you Curtis239

9 its recommended

Thank you,Relic
Just as you said,Cg program must be initialized after the GL context has been created, but the cgCreateContext() can be called after querying supported OpenGL profiles in my program.

Another problem is,I can not generates a CGprogram object by the second parameter “program_type = CG_OBJECT”, always a CG_PROGRAM_LOAD_ERROR error occured.
Thanks for any help, :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.