Exploding WGL Code

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Exploding WGL Code

Post by Baker »

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 ..
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Exploding WGL Code

Post by Spike »

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
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Exploding WGL Code

Post by Baker »

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 ..
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Exploding WGL Code

Post by mh »

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
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Exploding WGL Code

Post by revelator »

As mh says easiest way to get around all this ;)
Productivity is a state of mind.
Post Reply