# OPENGLBLIT and Mac OSX

**URL:** <https://discourse.libsdl.org/t/openglblit-and-mac-osx/4288>\
**Category:** SDL Development\
**Created:** [April 17, 2001, 1:59am UTC](https://discourse.libsdl.org/t/openglblit-and-mac-osx/4288 "2001-04-17T01:59:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Bonczkowski](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@Josh\_Bonczkowski](https://discourse.libsdl.org/u/Josh_Bonczkowski)\
**Post date:** [April 17, 2001, 1:59am UTC](https://discourse.libsdl.org/t/openglblit-and-mac-osx/4288/1 "2001-04-17T01:59:31Z")

</div>

I am playing around with SDL and decided to build an OpenGL sample.  
I started with SDL\_OPENGLBLIT turned on and ran into problems. I then  
traced it do only to the use of OPENGLBLIT.

I can run the included test program with no options and everything  
is fine. The sample runs  
and even at a decent frame rate 🙂 If the ‘-logo’ is passed to the  
testgl sample, it attempts to use SDL\_OPENGLBLIT and then dies with this  
error message: Couldn’t load GL function: glBegin

Any ideas?

---

<div class="post-metadata">

**Author:** ![Darrell\_Walisser](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/darrell_walisser/32/588_2.png) [@Darrell\_Walisser](https://discourse.libsdl.org/u/Darrell_Walisser)\
**Post date:** [April 17, 2001, 5:10am UTC](https://discourse.libsdl.org/t/openglblit-and-mac-osx/4288/2 "2001-04-17T05:10:22Z")

</div>

SDL calls GL functions like so:

this-\>glFlush();

So that you can run SDL with OpenGL installed, since the symbol  
“glBegin()” is loaded explicitly. In other words, the run-time  
dependency of OpenGL has been removed. Which is actually a nice feature.

BUT SDL\_GL\_GetProcAddress is of course broken on MacOS X. I will attempt  
to fix this in the upcoming Quartz video driver.

A quick hack would be to change the macro in SDL\_Video.c:

#ifdef HAVE\_OPENGL  
#define SDL\_PROC(ret,func,params)   
do {   
video-\>func = SDL\_GL\_GetProcAddress(#func);   
if ( ! video-\>func ) {   
SDL\_SetError(“Couldn’t load GL function: %s\n”, #func);   
return(NULL);   
}   
} while ( 0 );

To take out the test, and force the linker to load the function at  
runtime (whether you use OpenGL blitting or not.

For example:

video-\>func = #func;On Monday, April 16, 2001, at 08:59 PM, Josh Bonczkowski wrote:

> I am playing around with SDL and decided to build an OpenGL sample.  
> I started with SDL\_OPENGLBLIT turned on and ran into problems. I then  
> traced it do only to the use of OPENGLBLIT.
> 
> I can run the included test program with no options and everything  
> is fine. The sample runs  
> and even at a decent frame rate 🙂 If the ‘-logo’ is passed to the  
> testgl sample, it attempts to use SDL\_OPENGLBLIT and then dies with this  
> error message: Couldn’t load GL function: glBegin
> 
> Any ideas?
