I have an application that runs on Windows, Linux, and mac. I recently attempted to run it on a laptop running XP and I get an Access Violation during a glCallLists call. I am also switching to VS 2005.
I have boiled it down to a problem using the std:string andglCallLists.
This works:
glCallLists( 26, GL_BYTE, “This is simply too strange”);
This causes a violation:
std::string s=“This is simply too strange”;
glCallLists( 26, GL_BYTE, s.c_str());
Any advice/tips greatly appreciated…
Is it the MS STL implementation - should I try STL Port? Or is it more likely a driver issue? (Card in question is an nvidia 7800 Go)
This is not the recommended way of initializing an std:string, rather you should do this:
std::string s(“This is simply too strange”);
It has to do with the allocation of the string literal and the assignment operator for std:string, offhand I can’t remember the details.
But more importantly, I have a hard time understanding why you would use a string to hold your display list names, wouldn’t a vector be more appropriate? Obviously this example is fictious, because glCallLists will look at the numeric value of these characters, unless this is the intent and you have mapped your display list values to ascii character values.