[Openmcl-devel] openGL

Gary Byers gb at clozure.com
Wed Dec 18 16:07:52 UTC 2002



On Wed, 18 Dec 2002, nik gaffney wrote:

> > I don't know enought about OpenGL to know if that set of translated
> > header files is complete; it seems to be about equivalent to what
> > OpenMCL's provided for GL under LinuxPPC.
>
> maybe i missed something after untaring the darwin-gl-interfaces, and seting
> the interface dir.. .

Um, opening a shared library or two ?

>
> ? (use-interface-dir :gl)
> #<INTERFACE-DIR :GL #P"gl/" #x5501346>

This makes it possible to use #$ to reference GL-related
constants (via #$) and makes GL-related types and data
structures available.  It makes the signature of GL-related
foreign functions available (via #_).

It's roughly equivalent to having #include'ed the equivalent
.h files in a C program.

>
> but doesnt look like the gl stuff is there.. ..
>
> 2 > (foreign-symbol-address "_NSClassFromString")
> #<A Mac Pointer #x907F4858>
>

FOREIGN-SYMBOL-ADDRESS looks (at runtime) for the address of
the specified symbol in loaded shared libraries,  The address
of "_NSClassFromString" is available in your environment
because you've loaded the Cocoa libraries (presumably by
having loaded the Cocoa demo.)

If USE-INTERFACE-DIR is analogous to #include, then
OPEN-SHARED-LIBRARY is somewhat analogous to saying
"-l" or "-framework" when linking a C program.
Both steps are generally necessary.

> 2 > (foreign-symbol-address "_CGLGetVersion")
> NIL
>


> 2 > (foreign-symbol-address "CGLGetVersion")
> NIL
>
? (open-shared-library "/System/Library/Frameworks/OpenGL.framework/OpenGL")
#<SHLIB /System/Library/Frameworks/OpenGL.framework/OpenGL #x52F7F36>
? (foreign-symbol-address "_CGLGetVersion")
#<A Mac Pointer #x90AAE600>

> 3 > (foreign-symbol-address "_NSOpenGLView")
> NIL

"NSOpenGLView" is an Objective-C class name, not the name of a foreign
function or variable.  (Though I believe that there -are- variables
that define the addresses if ObjC classes - with some prefix in front
of the class name - it's usually preferable to refer to the class via
the @CLASS macro.)

>
> 4 > (foreign-symbol-address "aglGetVersion")
> NIL

I honestly don't know where this is defined or how its capitalized.
Under MacOS, foreign symbols that are accessible to C always have
leading underscores prepended to their names.

>
> 4 > (foreign-symbol-address "_NSBeep")
> #<A Mac Pointer #x932B2EF4>
>
>
? (rlet ((major :long)
         (minor :long))
    (#_CGLGetVersion major minor)
    (format t "~d.~d" (pref major :long) (pref minor :long)))

I seem to have CGL version 1.0 installed.

The effect of (use-interface-dir :gl) on the code above was to tell
the #_ reader macro (and other things) to look for foreign definitions
in that directory ("ccl:darwin-headers;gl;").  When #_ looked there,
it found that CGLGetVersion was a function that took two pointer
arguments and didn't return anything interesting.

That enabled the call to _CGLGetVersion above to compile; when it
ran (a split-second later), something like FOREIGN-SYMBOL-ADDRESS
was used to find and (temporarily) cache _CGLGetVersion's address
so that it could be called.

>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel
>
>


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list