abt glGetString()

I am using glGetString(GL_VERSION) to get system’s openGL version so that i can implement sum new features…heres the code…

std::string ver((const char*) glGetString( GL_VERSION ));
assert( !ver.empty() );
std::istringstream verStream( ver );

int major, minor;
char dummySep;
verStream >> major >> dummySep >> minor;

But i am gettn a runtime error…

The application has requested the runtime to terminate in an unusual manner.Contact your application’s support team for more informations.


Where is this code called? Do you have a valid GL context when glGetString is called?

Try to find out where exactly your code is crashing. Either by running it in a debugger, or by insterting tons of tracing output.

You should also check the return value of glGetString.