For the records and for the archives:
The error described below is a result of not having created a valid OpenGL context (= window) before calling an OpenGL function. No matter what function gets called before having a windows OpenGL is quite unforgiving and will crash the app with a bus error.
So, OpenGL does not even allow for querying the version info without a window ...
Well, not to be forgotten - it was one of those Unknown Unknowns.
;-)
Thanks to everybody for the feedback, help and support.
Cheers Frank
Am 08.05.2009 um 14:48 schrieb Frank Goenninger:
Hi all:
While resurrecting Kenny Tilton's Cello and trying to reuse some code of the cl-opengl bindings (trying to unite the two) I came across this error:
Source:
(define-foreign-library OpenGL (:darwin (:framework "OpenGL")) (:windows "opengl32.dll" :calling-convention :stdcall) (:unix (:or "libGL.so" "libGL.so.2" "libGL.so.1")))
(use-foreign-library OpenGL)
(define-foreign-library GLU (:windows "glu32.dll") ((:and :unix (:not :darwin)) (:or "libGLU.so.1" "libGLU.so")) ((:not :darwin) (:default "libGLU")))
(use-foreign-library GLU)
(defconstant GL_VERSION #x1f02) (defctype GLenum :unsigned-int)
(defmacro defglfun ((cname lname) result-type &body body) `(progn (declaim (inline ,lname)) (defcfun (,cname ,lname :library OpenGL) ,result-type ,@body)))
(defglfun ("glGetString" %glGetString) :pointer (name GLenum))
(defun gl-get-version () (let ((version-string (%glGetString GL_VERSION))) ;; <<<<---- BUS ERROR ! (break) (foreign-string-to-lisp version-string)))
REPL:
; Foreign loading /System/Library/Frameworks/OpenGL.framework/ OpenGL. CL-USER > (gl-get-version) Bus Error (Signal 10)
Oh, btw, that happens no matter what function from OpenGL I try to call... So, something very fundamental must be wrong here. I just can't see what ... Please help!
TIA!!!!
Best, Frank
cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
-- Frank Goenninger
Cell: +49 175 4321058 E-Mail: frgo@me.com