PDA

View Full Version : need help, cgGLIsProfileSupported() always returns false



include
05-08-2006, 04:28 AM
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)
{
InitCG();
}
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;
else
{
//g_CGprofile_vertex = cgGLGetLatestProfile(CG_GL_VERTEX);
//CG_PROFILE_UNKNOWN;
AfxMessageBox( "Vertex Shader hardware init failed.",MB_OK );
// return;
}
...
}

Relic
05-08-2006, 06:05 AM
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:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfdllmain.asp

curtis239
05-08-2006, 12:59 PM
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

include
05-08-2006, 09:19 PM
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.

include
05-08-2006, 09:28 PM
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, :)