On Dec 26, 2009, at 16:48, Tony Bernardin wrote:
> I had posted this to the Mac-OpenGL list orginally and was recommended to
> post it here instead.
>
> cheers,
> Tony
>
> On Tue, Dec 22, 2009 at 2:41 PM, Tony Bernardin <
email@hidden> wrote:
>
>> I'm running into some issues building some OpenGL stuff on snow leopard.
>> The gist of it is that I have to use the X11 OpenGL lib instead of the
>> framework due to another library that I use (VRUI). This worked fine in
>> Leopard before. But now with snow leopard I've got all these warnings about
>> GL_GLEXT_PROTOTYPES (henceforth GGP) being redefined. At first I thought
>> some of my/VRUI's code was at fault (that library needs to define the GGP).
>> But then while looking through the /usr/X11R6/include/GL/gl.h I found the
>> following:
>>
>> 1363 /* On SL, we want to use OpelGL.framework's headers to get both
>> prototypes and
>> 1364 * function pointers (like Mesa's API), but on Leo and before,
>> OpenGL.framework
>> 1365 * can't give us both.
>> 1366 */
>> 1367
>> 1368 #ifdef GL_GLEXT_FUNCTION_POINTERS
>> 1369 #define _GL_GLEXT_FUNCTION_POINTERS GL_GLEXT_FUNCTION_POINTERS
>> 1370 #undef GL_GLEXT_FUNCTION_POINTERS
>> 1371 #endif
>> 1372
>> 1373 #ifdef GL_GLEXT_PROTOTYPES
>> 1374 #define _GL_GLEXT_PROTOTYPES GL_GLEXT_PROTOTYPES
>> 1375 #else
>> 1376 #define GL_GLEXT_PROTOTYPES 1
>> 1377 #endif
>> 1378
>> 1379 /* Our glext.h is based on a version from the registry that is newer.
>> */
>> 1380 #ifdef GL_GLEXT_LEGACY
>> 1381 #define _GL_GLEXT_LEGACY GL_GLEXT_LEGACY
>> 1382 #else
>> 1383 #define GL_GLEXT_LEGACY 1
>> 1384 #endif
>> 1385
>> 1386 #include "/System/Library/Frameworks/
>> OpenGL.framework/Headers/gl.h"
>> 1387
>> 1388 /* Restore our GLEXT-fu */
>> 1389 #ifdef _GL_GLEXT_FUNCTION_POINTERS
>> 1390 #define GL_GLEXT_FUNCTION_POINTERS _GL_GLEXT_FUNCTION_POINTERS
>> 1391 #else
>> 1392 #undef GL_GLEXT_FUNCTION_POINTERS
>> 1393 #endif
>> 1394
>> 1395 #ifdef _GL_GLEXT_PROTOTYPES
>> 1396 #define GL_GLEXT_PROTOTYPES _GL_GLEXT_PROTOTYPES
>> 1397 #else
>> 1398 #undef GL_GLEXT_PROTOTYPES
>> 1399 #endif
>>
>> now correct me if I'm wrong, but isn't this always going to complain if I
>> have GGP set? @ 1373 it's going to be true so it'll set _GGP, then include
>> the Framework's gl.h then @ 1395 it's going to find _GGP to be true so then
>> it'll try to redefine GGP @ 1396.
>>
>> I think I see what they want to do, and that is to make sure that GGP is
>> set no matter what before they include the Framework's gl.h. But then they
>> want to make sure to restore whatever the previous state was. They use _GGP
>> to keep track of if they made a change or not, since _GGP is not going to be
>> set if they have changed GGP to be 1 themselves. But since _GGP *is* GGP
>> what's the point of #define GGP _GGP especially since then GGP will already
>> have been defined for sure.
>>
>> I'm a little scared to touch the gl.h myself, but I changed the Restore
>> section to just have
>>
>> #ifndef _GGP
>> #undef GGP
>> #endif
>>
>> and that seems to have worked fine and gotten rid of all the warnings. Any
>> thoughts?
>>
>> cheers,
>> Tony
>>