Professional Web Applications Themes

(OpenGL) Dynamic load of GL, GLU and GLUT? - Mac Programming

My poking around on various NGs suggest the way to link an OpenGL app under OS X (I have Panther and XCode, fwiw) is via some (seemingly) OS X-specific "-framework OpenGL" and "-framework Glut" build options. Unfortunately, I am trying to use Lisp, where libraries are loaded dynamically. That would be DLLs on win32 and .SOs (I gather--this is all new to me) on a *nix. Been searching my HD as well as the NGs, and I do not see anything looking like a library I can load. I believe there are two commercial Lisps on the Max which support ...

  1. #1

    Default (OpenGL) Dynamic load of GL, GLU and GLUT?

    My poking around on various NGs suggest the way to link an OpenGL app
    under OS X (I have Panther and XCode, fwiw) is via some (seemingly) OS
    X-specific "-framework OpenGL" and "-framework Glut" build options.

    Unfortunately, I am trying to use Lisp, where libraries are loaded
    dynamically. That would be DLLs on win32 and .SOs (I gather--this is all
    new to me) on a *nix. Been searching my HD as well as the NGs, and I do
    not see anything looking like a library I can load.

    I believe there are two commercial Lisps on the Max which support
    OpenGL, but maybe they link their exes against the -frameworks? I'll ask
    back on comp.lang.lisp about that. SBCL is an open source Lisp (as is
    Open MCL) on OS X -- maybe I those can be linked against the -frameworks?

    Sorry about the handwaving--I am just getting started on sorting this
    out and even *nix is news to me.

    kt

    --
    http://tilton-technology.com

    Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film

    Your Project Here! http://alu.cliki.net/Industry%20Application

    Kenny Guest

  2. #2

    Default Re: (OpenGL) Dynamic load of GL, GLU and GLUT?

    In article <RrVAb.371469$nyc.rr.com>,
    Kenny Tilton <rr.com> wrote:
     

    Frameworks on OS X *are* dynamic libraries which you can load at
    runtime. If your Lisp can't load them on OS X, then it is broken. It is
    about two lines of code in Cocoa to load a framework at runtime, so it
    ought to be easy from Lisp too.
    Michael Guest

  3. #3

    Default Re: (OpenGL) Dynamic load of GL, GLU and GLUT?

    Michael Ash <com> writes:
     
    >
    > Frameworks on OS X *are* dynamic libraries which you can load at
    > runtime. If your Lisp can't load them on OS X, then it is broken. It is
    > about two lines of code in Cocoa to load a framework at runtime, so it
    > ought to be easy from Lisp too.[/ref]

    I responded to a similar thread in c.l.l about this topic. Only
    after I posted it did it occur to me that Kenny was looking for .so
    files instead of .dylib files.

    It is also much easier from another language perspective to go with C
    linkage conventions and load C style libs rather than Objective-C
    libs. Although from what I've found, I'm guessing that the C style
    OpenGL libs are there and usable (headers and libs under X11R6). The
    header files say that the implementation is actually Mesa.

    I don't know much about Objective-C yet. I'm reading the PDF right
    now. If Objective-C libs are like C libs, then I'm going to guess
    that there is some name mangling that goes on with the exported
    labels. I'm basing this on my C++ experience where that was how
    function signatures were handled.

    --
    One Emacs to rule them all. One Emacs to find them,
    One Emacs to take commands and to the keystrokes bind them,

    All other programming languages wish they were Lisp.
    David Guest

  4. #4

    Default Re: (OpenGL) Dynamic load of GL, GLU and GLUT?



    Michael Ash wrote: 
    >
    >
    > Frameworks on OS X *are* dynamic libraries which you can load at
    > runtime.[/ref]

    Well, looking at GLUT.framework now it looks like a folder containing an
    alias called GLUT which points a few directories deeper to GLUT, a Unix
    executable. But I understand that is how things work on OS X,
    directories qua things.

    I'll definitely try simply loading the framework. I guess the question
    is (and I'll know soon enough <g>) is whether loading the framework gets
    translated by OS X or if the linker you are using is doing that. If it
    is the linker, you are right, it comes down to whether the several Lisp
    environments are fully OS X-aware. If not, I'll want a workaround
    (unwrapping the frameworks myself) until those implementations get up to
    speed.

    I am a little concerned because the OpenGL.framework eventually leads to
    stuff more encouragingly named with the extension .dylib, which I gather
    from others is the OS X variant of .SO. The GlUT.framework just leads to
    "GLUT". And the dylibs are described simply as "doent" by Preview,
    whereas GLU is a Unix executable. Hmmm...

    Thx for the input. Others in the Lisp NG have also weighed in with a lot
    of good info, so I should muddle thru eventually.

    kt

    --
    http://tilton-technology.com

    Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film

    Your Project Here! http://alu.cliki.net/Industry%20Application

    Kenny Guest

  5. #5

    Default Re: (OpenGL) Dynamic load of GL, GLU and GLUT?

    In article <com>,
    David Steuber <net> wrote:
     

    I don't think there is such a thing as "Objective-C libs". There are
    libraries which happen to contain Objective-C code, but they aren't
    fundamentally different.
     

    Anything in X11R6 is part of X11, and so you can't assume anybody else
    is going to have it, since X11 is an optional component.
     

    ObjC exports some of its own things (classes, methods) and it can export
    everything C can export, since it is a superset of C. When it exports C
    things, it exports them just like C does, without name mangling. Unlike
    C++, ObjC is a *pure* superset of C; you can take any C program and
    compile it with the ObjC compiler, and the result will be exactly the
    same.

    It is entirely possible to load an ObjC library and access it from a C
    program. You can call ObjC runtime functions directly, for example using
    objc_msgSend() to send ObjC messages, etc. ObjC is a very thin OO layer
    on top of C, not comparable to C++ at all in this respect. The only
    gotcha that I'm aware of is that if your program doesn't use ObjC and it
    dynamically loads a library that does, then you have to manually
    initialize the ObjC runtime before you load it. This is a simple
    function call whose name I've forgotten.
    Michael Guest

  6. #6

    Default Re: (OpenGL) Dynamic load of GL, GLU and GLUT?

    Michael Ash <com> writes:
     
    >
    > Anything in X11R6 is part of X11, and so you can't assume anybody else
    > is going to have it, since X11 is an optional component.[/ref]

    Good point.

    I read another followup posting that the frameworks are just regular
    libs like *.dylib files. So it looks to me like it is a simple
    matter of linker settings when building a program (from a C
    perspective). Is that about right? That is you just specify which
    frameworks you will be using.
     

    Interesting. That makes things much easier than dealing with C++
    code from foreign code. I take it then that any language that wishes
    to use the Objective-C libraries like Cocoa simply needs to do what
    you would do from a C program: load the lib, initialize the runtime,
    and you are good to go.

    I'm getting further along in the Objective-C PDF file. It is an
    interesting language. I must admit though that before I hit
    Categories, I was wondering why not C++.

    --
    One Emacs to rule them all. One Emacs to find them,
    One Emacs to take commands and to the keystrokes bind them,

    All other programming languages wish they were Lisp.
    David Guest

  7. #7

    Default Re: (OpenGL) Dynamic load of GL, GLU and GLUT?

    In article <com>,
    David Steuber <net> wrote:
     

    As far as I know, a Framework is just a .dylib bundled up in a package
    that allows versioning, plus any header files, subframeworks, and other
    resources that may go along with the library.
     

    I believe so. Of course, when I load ObjC libraries dynamically, I just
    ask NSBundle to do it for me, so I don't see any of what goes on behind
    the scenes.
     

    Categories aren't even the big attraction, they're more of an
    interesting extra bit. To really see what ObjC offers over C++ would be
    too much to get into here, but have a look at the 'id' type and what you
    can do with it.
    Michael Guest

Similar Threads

  1. How to dynamic load my plugin?
    By NoSmoking@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 2
    Last Post: January 5th, 01:05 AM
  2. Dynamic Load- Offline Ok! Online No WAY
    By Tramaine2004 in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: September 20th, 02:11 PM
  3. Control fails on dynamic load
    By Joel Reinford in forum ASP.NET Building Controls
    Replies: 2
    Last Post: March 20th, 09:19 AM
  4. ruby-opengl, ruby-glut
    By Alwin in forum Ruby
    Replies: 5
    Last Post: January 21st, 12:58 PM
  5. GLUT changes in Jaguar
    By Mikey in forum Mac Programming
    Replies: 2
    Last Post: July 10th, 04:37 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139