Menu

#153 warning: 'gluPerspective' is deprecated: first deprecated in OS X 10.9 - "Use GLKMatrix4MakePerspective"

v1.6.2.0
closed-fixed
None
1
2018-03-14
2014-12-11
No

The following warning appears when building pymol 1.7.4.0 on OS X 10.10

layer1/Scene.cpp:9159:7: warning: 'gluPerspective' is deprecated: first deprecated in OS X 10.9 - "Use GLKMatrix4MakePerspective" [-Wdeprecated-declarations]
      gluPerspective(fov, aspRat, I->FrontSafe, I->BackSafe);
      ^
/System/Library/Frameworks/OpenGL.framework/Headers/glu.h:278:13: note: 'gluPerspective' has been explicitly marked deprecated here
extern void gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) OPENGL_DEPRECATED_MSG(10_0, 10_9, "Use GLKMatrix4MakePerspective");
            ^

This should be fixed with the change...

--- pymol-1.7.4.0/layer1/Scene.cpp.orig 2014-12-11 12:48:50.000000000 -0500
+++ pymol-1.7.4.0/layer1/Scene.cpp      2014-12-11 13:30:54.000000000 -0500
@@ -57,6 +57,8 @@
 #include"ScrollBar.h"
 #include "ShaderMgr.h"

+#include <GLKit/GLKMatrix4.h>
+
 #ifdef _PYMOL_IP_EXTRAS
 #include "IncentiveCopyToClipboard.h"
 #endif
@@ -9156,7 +9158,8 @@
     }
     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, aspRat, I->FrontSafe, I->BackSafe).m);
     } else {
       height = fmax(R_SMALL4, -I->Pos[2]) * GetFovWidth(G) / 2.f;
       width = height * aspRat;
--- pymol-1.7.4.0/setup.py.orig 2014-12-11 13:59:08.000000000 -0500
+++ pymol-1.7.4.0/setup.py      2014-12-11 14:02:20.000000000 -0500
@@ -279,6 +279,11 @@
         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

but the resulting build produces rendering that is about 10 times too smaller in the Pymol window when running the demos. Any idea what is missing here?

Discussion

  • Thomas Holder

    Thomas Holder - 2014-12-11

    fov is degrees, not radians, so you should use (fov * PI / 180.).

    This is not a bug. Yes it's deprecated, but it's cross platform (unlike GLKit) and nothing is broken, so giving this low priority for now.

     
  • Thomas Holder

    Thomas Holder - 2014-12-11
    • assigned_to: Thomas Holder
    • Priority: 5 --> 1
     
  • Jack Howarth

    Jack Howarth - 2014-12-11

    Thank. Scaling fov solved the rendering issue. The other depreciated call...

    layer0/os_gl.cpp:99:59: warning: 'gluErrorString' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
    printf("OpenGL-Error: Where? %s: %s\n", pos, (char *) gluErrorString(glerr));
    ^
    /System/Library/Frameworks/OpenGL.framework/Headers/glu.h:260:24: note: 'gluErrorString' has been explicitly marked deprecated here
    extern const GLubyte * gluErrorString (GLenum error) OPENGL_DEPRECATED(10_0, 10_9);

    doesn't appear to have a replacement function available.

     
  • Thomas Holder

    Thomas Holder - 2018-02-20

    For the record:

    diff --git a/layer1/Scene.cpp b/layer1/Scene.cpp
    index 90ef6d6d6..d8d66f3b4 100644
    --- a/layer1/Scene.cpp
    +++ b/layer1/Scene.cpp
    @@ -9144,8 +9144,9 @@ void SceneRender(PyMOLGlobals * G, Picking * pick, int x, int y,
           curState = SettingGetGlobal_i(G, cSetting_state) - 1;
         }
         if(!SettingGetGlobal_b(G, cSetting_ortho)) {
    -      float fov = SettingGetGlobal_f(G, cSetting_field_of_view);
    -      gluPerspective(fov, aspRat, I->FrontSafe, I->BackSafe);
    +      height = I->FrontSafe * GetFovWidth(G) / 2.f;
    +      width = height * aspRat;
    +      glFrustum(-width, width, -height, height, I->FrontSafe, I->BackSafe);
         } else {
           height = std::max(R_SMALL4, -I->Pos[2]) * GetFovWidth(G) / 2.f;
           width = height * aspRat;
    
     
  • Thomas Holder

    Thomas Holder - 2018-03-14
    • status: open --> closed-fixed
     
  • Thomas Holder

    Thomas Holder - 2018-03-14

    GLU dependency removed in svn rev 4187

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.