tzlaine wrote:
Did you build GG with its SCons build system? It appears you did not, since I found "#ifdef FREEORION_MACOSX" in your changes to GG/Ogre/OgreGUI.h. Before I can accept this patch for GG's trunk, I'll need your assurance that the SCons build works. Otherwise, I'll stick this changeset in a patches directory in the GG repository.
Glad, I checked this. There was a bug where I #ifdef instead of #if, use this patch for OgreGUI.cpp instead of what was in previous files:
Code:
Index: src/Ogre/OgreGUI.cpp
===================================================================
--- src/Ogre/OgreGUI.cpp (revision 711)
+++ src/Ogre/OgreGUI.cpp (working copy)
@@ -33,6 +33,10 @@
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#include <GL/gl.h>
#include <GG/glext.h>
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#include "aglGetProcAddress.h"
#else
#include <GL/glx.h>
#endif
@@ -191,6 +195,10 @@
typedef void (*BindBufferARBFn)(GLenum, GLuint);
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
BindBufferARBFn glBindBufferARB = (BindBufferARBFn)wglGetProcAddress("glBindBufferARB");
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ OSStatus err = aglInitEntryPoints (); //init bundle
+ if (err != noErr) Exit(err);
+ BindBufferARBFn glBindBufferARB = (BindBufferARBFn)aglGetProcAddress("glBindBufferARB");
#else
BindBufferARBFn glBindBufferARB = (BindBufferARBFn)glXGetProcAddress((const GLubyte* )"glBindBufferARB");
#endif
@@ -204,6 +212,8 @@
typedef void (*UseProgramARBFn)(GLuint);
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
UseProgramARBFn glUseProgramARB = (UseProgramARBFn)wglGetProcAddress("glUseProgramARB");
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ UseProgramARBFn glUseProgramARB = (UseProgramARBFn)aglGetProcAddress("glUseProgramARB");
#else
UseProgramARBFn glUseProgramARB = (UseProgramARBFn)glXGetProcAddress((const GLubyte* )"glUseProgramARB");
#endif
@@ -222,6 +232,9 @@
void OgreGUI::Exit2DMode()
{
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ aglDellocEntryPoints();
+#endif
glPopClientAttrib();
glPopAttrib();
}
And given that it's in GG source, I think it's more appropriate to check for __APPLE__ instead of FREEORION_MACOSX here?
Code:
Index: GG/Ogre/OgreGUI.h
===================================================================
--- GG/Ogre/OgreGUI.h (revision 711)
+++ GG/Ogre/OgreGUI.h (working copy)
@@ -29,6 +29,21 @@
#ifndef _GG_OgreGUI_h_
#define _GG_OgreGUI_h_
+#ifdef __APPLE__
+/* prevents OpenTransportProviders.h (a system header in Mac SDKs)
+ from trying to enum what's already defined by includeing it elsewhere */
+#undef TCP_NODELAY
+#undef TCP_MAXSEG
+#undef TCP_NOTIFY_THRESHOLD
+#undef TCP_ABORT_THRESHOLD
+#undef TCP_CONN_NOTIFY_THRESHOLD
+#undef TCP_CONN_ABORT_THRESHOLD
+#undef TCP_OOBINLINE
+#undef TCP_URGENT_PTR_TYPE
+#undef TCP_KEEPALIVE
+#include <Carbon/Carbon.h>
+#endif
+
#include <OgreDataStream.h>
#include <OgreRenderTargetListener.h>
#include <OgreSharedPtr.h>
These compile with SCons on linux and still in Xcode.
I can rewrite that code to get OpenGL entry points if you'd like.