View Full Version : glGetString returns nothing!

Ehsan Kamrani
10-19-2006, 07:58 AM
I have downloded and installed the latest version of my graphic card. However glGetString( GL_VENDOR )-Or other parameters of this function- does not return a string. GLinfo can detect the name of the vendor, OpenGL version and other information of my driver. here's the features of my graphic card reported by GLinfo:
Driver Version :
Vendor : NVIDIA Corporation
Renderer : Geforce FX 5500 AGP/SSE2/3DNOW!
OpenGL Version : 2.0.3

And here's my code:
bool GRAPHICCARD::detect()
char renderer[256] = "";
if( glGetString( GL_VENDOR ) == NULL )
MessageBox( NULL, "ERROR 101\nWe can not detect your graphic card.However we don't stop the program.\nThere's no guarantee that it is run correctly!", "Persian Engine Error", MB_OK | MB_ICONERROR );
strcpy( renderer, (char*)glGetString( GL_VENDOR ) );
strupr( renderer );
if( strstr( renderer, "MICROSOFT" ) != NULL )
MessageBox( NULL, "Please install your graphic card", "Persian Engine Error", MB_OK | MB_ICONINFORMATION );
return false;

return true;

My code reports an error. However as glGetString returns NULL, my program can not detect the graphic card.
What's the problem?

10-19-2006, 08:30 AM
All OpenGL functions need working context. So you must do all the ChoosePixelFormat / wglCreateContext / wglMakeCurrent stuff first.

Ehsan Kamrani
10-19-2006, 08:58 AM
Thanks. I had called this class before my raster class! A funny mistake ;)