Ticket #47244: pymol-use-glkit.diff

File pymol-use-glkit.diff, 3.2 KB (added by howarth.at.macports@…, 9 years ago)

replacement patch for pymol-use-glkit.diff

  • layer0/os_gl.cpp

     
    33
    44#include<stdio.h>
    55
     6const char* PyMOLgluErrorString(GLenum errorCode)
     7{
     8        static const struct {
     9                GLenum code;
     10                const char *string;
     11        } errors[]=
     12        {
     13                /* GL */
     14                {GL_NO_ERROR, "no error"},
     15                {GL_INVALID_ENUM, "invalid enumerant"},
     16                {GL_INVALID_VALUE, "invalid value"},
     17                {GL_INVALID_OPERATION, "invalid operation"},
     18                {GL_STACK_OVERFLOW, "stack overflow"},
     19                {GL_STACK_UNDERFLOW, "stack underflow"},
     20                {GL_OUT_OF_MEMORY, "out of memory"},
     21                {GLU_INVALID_ENUM, "invalid enumerant"},
     22                {GLU_INVALID_VALUE, "invalid value"},
     23                {GLU_OUT_OF_MEMORY, "out of memory"},
     24                {GLU_INCOMPATIBLE_GL_VERSION, "incompatible gl version"},
     25                {GLU_INVALID_OPERATION, "invalid operation"},
     26
     27        {0, NULL }
     28        };
     29
     30        int i;
     31
     32        for (i=0; errors[i].string; i++)
     33        {
     34                if (errors[i].code == errorCode)
     35                {
     36                        return errors[i].string;
     37                }
     38        }
     39
     40        return NULL;
     41}
     42               
    643void PyMOLReadPixels(GLint x,
    744                     GLint y,
    845                     GLsizei width,
    int PyMOLCheckOpenGLErr(const char *pos) 
    96133  int flag = 0;
    97134  GLenum glerr = glGetError();
    98135  while(glerr != GL_NO_ERROR) {
    99     printf("OpenGL-Error: Where? %s: %s\n", pos, (char *) gluErrorString(glerr));
     136    printf("OpenGL-Error: Where? %s: %s\n", pos, (char *) PyMOLgluErrorString(glerr));
    100137    glerr = glGetError();
    101138    flag = 1;
    102139  }
  • layer0/os_gl.h

     
    6464
    6565/* END PROPRIETARY CODE SEGMENT */
    6666
     67static const char* PyMOLgluErrorString(GLenum errorCode);
     68
    6769void PyMOLReadPixels(GLint x,
    6870                     GLint y,
    6971                     GLsizei width,
  • layer1/Scene.cpp

    Z* ------------------------------------- 
    6060#include <string>
    6161#include <vector>
    6262
     63#include <GLKit/GLKMatrix4.h>
     64
    6365#ifdef _PYMOL_IP_EXTRAS
    6466#include "IncentiveCopyToClipboard.h"
    6567#endif
    void SceneRender(PyMOLGlobals * G, Picki 
    90729074    }
    90739075    if(!SettingGetGlobal_b(G, cSetting_ortho)) {
    90749076      float fov = SettingGetGlobal_f(G, cSetting_field_of_view);
    9075       gluPerspective(fov, aspRat, I->FrontSafe, I->BackSafe);
     9077      // gluPerspective(fov, aspRat, I->FrontSafe, I->BackSafe);
     9078      glMultMatrixf(GLKMatrix4MakePerspective(fov*PI/180., aspRat, I->FrontSafe, I->BackSafe).m);
    90769079    } else {
    90779080      height = fmax(R_SMALL4, -I->Pos[2]) * GetFovWidth(G) / 2.f;
    90789081      width = height * aspRat;
  • setup.py

    else: # unix style (linux, mac, ...) 
    274274        glut = posix_find_lib(['glut', 'freeglut'], lib_dirs)
    275275        pyogl_libs += ["GL", "GLU", glut]
    276276
     277    if sys.platform == 'darwin':
     278       ext_link_args += [
     279         "-framework", "GLKit",
     280        ]
     281
    277282    libs += ["GLEW"]
    278283    libs += pyogl_libs
    279284