Reputation: 19672
I inherited an old code base using OpenGL inside X11. The header includes is like this
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <X11/Intrinsic.h>
#include <GL/glx.h>
#include <GL/gl.h>
#include <X11/cursorfont.h>
I want to port this to Snow Leopard, my basic problem so far is that I can't get the proper headers or maybe I should say I cant get xcode to bind against the correct headers. I need to use things like
GLXDrawable drawable;
XVisualInfo *ptr;
GLXContext MainContext;
XSetWindowAttributes wa;
I tried to install X11 dev (I tried http://xquartz.macosforge.org/trac/wiki , I tried using fink to install x11 opengl dev libs and ...). Obviously I am not a C programmer (I have rather good experience in Objective c and iOS development though). Any help would be appreciated.
Upvotes: 0
Views: 1483
Reputation: 162164
The X11 server for MacOS X is rather limited and in my experience it has rather poor OpenGL support. So instead of trying to fit a square pig into a round hole I'd just use MacOS X native OpenGL API. The probably most easy way to get your thing portable is replace all that windowing specific stuff with GLFW, a neat OpenGL specific wrapper around X11/GLX, Win32 and MacOS X, that cares about OpenGL context creation and user input. BTW, user input: You'll have to adjust that one, too.
Don't get me wrong, I really like X11/GLX. And if I had not made those bad experiences with MacOS X's (Leopard) X11 server support for OpenGL, I'd gladly give advice how to tackle it. But I think in the end you'll keep your sanity if you just replace that X11 code with GLFW.
Upvotes: 1