Forum

Exploding WGL Code

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Exploding WGL Code

Postby Baker » Fri Jul 27, 2012 8:49 am

Code: Select all
void GetWGLExtensions (void)
{
   const char *(*wglGetExtensionsStringARB) (HDC hdc);
   const char *(*wglGetExtensionsStringEXT) ();

   if (wglGetExtensionsStringARB = (void *) wglGetProcAddress ("wglGetExtensionsStringARB"))
      wgl_extensions = wglGetExtensionsStringARB (maindc);
   else if (wglGetExtensionsStringEXT = (void *) wglGetProcAddress ("wglGetExtensionsStringEXT"))
      wgl_extensions = wglGetExtensionsStringEXT ();
   else
      wgl_extensions = "";
}
Only explodes with certain compile optimizations. Inconveniently, debug compile optimizations aren't one of the exploding ones, making locating exactly what was crashing somewhat of a pain. Those wgl extensions aren't really that useful for Quake (the only one I ever was interested in for Quake was the 2ndary way to detect swap control that some stupid Intel Display Adapters use, but there is a GL_swap_hint something or rather in the regular GL extensions for those, it is named in a non-standard way, yeah, but it is in the stock GL extensions list).

I ran into this messing around with my current project.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Exploding WGL Code

Postby Spike » Fri Jul 27, 2012 9:54 am

prototype with undefined argument list!! EEK!
no idea what would be crashing in that code though.
if in doubt, printf/OutputDebugStringA are your friends, when it crashes only with non-debug builds anyway.
make sure you're not editing the string somehow? :s
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Exploding WGL Code

Postby Baker » Fri Jul 27, 2012 10:02 am

It doesn't edit the string any where.

But I was a bit surprised that different optimizations would cause it crash or not crash. A slightly unfun mystery. :mrgreen: I ended up inserted about 40 "MessageBox" pop-ups and when it stopped at #17, I had it located but surprised to see that it was this.

Oh well, I found the crash point and it didn't take so long.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Exploding WGL Code

Postby mh » Fri Jul 27, 2012 4:38 pm

GLEW - because life's too short to load GL extensions by hand.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Exploding WGL Code

Postby revelator » Sat Jul 28, 2012 3:41 am

As mh says easiest way to get around all this ;)
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest