Index: layer0/os_gl.cpp =================================================================== --- layer0/os_gl.cpp (revision 4111) +++ layer0/os_gl.cpp (working copy) @@ -3,6 +3,43 @@ #include +const char* PyMOLgluErrorString(GLenum errorCode) +{ + static const struct { + GLenum code; + const char *string; + } errors[]= + { + /* GL */ + {GL_NO_ERROR, "no error"}, + {GL_INVALID_ENUM, "invalid enumerant"}, + {GL_INVALID_VALUE, "invalid value"}, + {GL_INVALID_OPERATION, "invalid operation"}, + {GL_STACK_OVERFLOW, "stack overflow"}, + {GL_STACK_UNDERFLOW, "stack underflow"}, + {GL_OUT_OF_MEMORY, "out of memory"}, + {GLU_INVALID_ENUM, "invalid enumerant"}, + {GLU_INVALID_VALUE, "invalid value"}, + {GLU_OUT_OF_MEMORY, "out of memory"}, + {GLU_INCOMPATIBLE_GL_VERSION, "incompatible gl version"}, + {GLU_INVALID_OPERATION, "invalid operation"}, + + {0, NULL } + }; + + int i; + + for (i=0; errors[i].string; i++) + { + if (errors[i].code == errorCode) + { + return errors[i].string; + } + } + + return NULL; +} + void PyMOLReadPixels(GLint x, GLint y, GLsizei width, @@ -96,7 +133,7 @@ int PyMOLCheckOpenGLErr(const char *pos) int flag = 0; GLenum glerr = glGetError(); while(glerr != GL_NO_ERROR) { - printf("OpenGL-Error: Where? %s: %s\n", pos, (char *) gluErrorString(glerr)); + printf("OpenGL-Error: Where? %s: %s\n", pos, (char *) PyMOLgluErrorString(glerr)); glerr = glGetError(); flag = 1; } Index: layer0/os_gl.h =================================================================== --- layer0/os_gl.h (revision 4111) +++ layer0/os_gl.h (working copy) @@ -64,6 +64,8 @@ /* END PROPRIETARY CODE SEGMENT */ +static const char* PyMOLgluErrorString(GLenum errorCode); + void PyMOLReadPixels(GLint x, GLint y, GLsizei width, Index: layer1/Scene.cpp =================================================================== --- layer1/Scene.cpp (revision 4111) +++ layer1/Scene.cpp (working copy) @@ -60,6 +60,8 @@ Z* ------------------------------------- #include #include +#include + #ifdef _PYMOL_IP_EXTRAS #include "IncentiveCopyToClipboard.h" #endif @@ -9072,7 +9074,8 @@ void SceneRender(PyMOLGlobals * G, Picki } if(!SettingGetGlobal_b(G, cSetting_ortho)) { float fov = SettingGetGlobal_f(G, cSetting_field_of_view); - gluPerspective(fov, aspRat, I->FrontSafe, I->BackSafe); + // gluPerspective(fov, aspRat, I->FrontSafe, I->BackSafe); + glMultMatrixf(GLKMatrix4MakePerspective(fov*PI/180., aspRat, I->FrontSafe, I->BackSafe).m); } else { height = fmax(R_SMALL4, -I->Pos[2]) * GetFovWidth(G) / 2.f; width = height * aspRat; Index: setup.py =================================================================== --- setup.py (revision 4111) +++ setup.py (working copy) @@ -274,6 +274,11 @@ else: # unix style (linux, mac, ...) glut = posix_find_lib(['glut', 'freeglut'], lib_dirs) pyogl_libs += ["GL", "GLU", glut] + if sys.platform == 'darwin': + ext_link_args += [ + "-framework", "GLKit", + ] + libs += ["GLEW"] libs += pyogl_libs