This may not be the proper list (I'm tempted to cross-post to the clozure one), but I have to start somewhere.
I'm putting together a wrapper around the recently released version of the C library GLFW. In the middle of a callback (written in CL and mostly using cl-glfw), I'm winding up in the debugger, and I'm not having any luck figuring out why.
I don't have a minimal test-case to share, yet. That's my next step. I'm being lazy and asking before I start trying to trim pieces down. The best nutshell of the problem I have at the moment is that the callback in question looks like:
(cffi:defcallback window-sizer
:void
((window glfw3::glfw-window) (width :int) (height :int))
;; Have to have the OpenGL context before we can do this.
;; Q: Should I be making that window's context current?
;; A: Seems really stupid to think otherwise.
(declare (ignore window))
(format t "Resizing to ~A x ~A~%" width height)
(gl:viewport 0 0 width height)
(format t "Setting projecting matrix~%")
(gl:matrix-mode :projection)
(gl:load-identity)
(let ((ratio (/ width height)))
(format t "Setting ortho: ~A~%" ratio)
;; This next line is failing here, pretty spectacularly.
;; with an error message that doesn't seem to make any sense.
;; It appears to run fine (even if it does nothing) when
;; I run it throuh the REPL.
(gl:ortho (- ratio) ratio -1 1 1 -1))
(format t "Returning~%"))
The stack trace (FWIW) looks like:
The value 17465867632912 is not of the expected type DOUBLE-FLOAT.
[Condition of type TYPE-ERROR]
0: (CFFI-CALLBACKS::|GLFW3-EXAMPLE::WINDOW-SIZER| 17465867632956)
Locals:
#:G7819 = 17465867632956
#:G7822 = #<A Foreign Pointer [stack-allocated] #x7F14B6B009E0>
GLFW3-EXAMPLE::WINDOW = #<A Foreign Pointer #x7F149C034C70>
GLFW3-EXAMPLE::WIDTH = 649
GLFW3-EXAMPLE::HEIGHT = 502
COMMON-LISP:RATIO = 649/502
CL-OPENGL-BINDINGS::LEFT = -649/502
#:G7833 = -1.292828685258964D0
#:G7834 = 1.292828685258964D0
#:G7835 = -1.0D0
#:G7836 = 1.0D0
#:G7837 = 1.0D0
#:G7838 = -1.0D0
1: (CCL::%PASCAL-FUNCTIONS% 5 17465867632956)
Locals:
INDEX = 5
ARGS-PTR-FIXNUM = 17465867632956
LISP-FUNCTION = #<Compiled-function CFFI-CALLBACKS::|GLFW3-EXAMPLE::WINDOW-SIZER| (Non-Global) #x302001CF9B0F>
WITHOUT-INTERRUPTS = NIL
*CALLBACK-TRACE-P* = NIL
2: (NIL #<Unknown Arguments>)
3: (POLL-EVENTS)
4: (CCL::CALL-CHECK-REGS POLL-EVENTS)
5: (CCL::CHEAP-EVAL (POLL-EVENTS))
Does anyone have a suggestion about where I should look to try to figure out where that value it's complaining about comes from? Or what's expecting the DOUBLE-FLOAT? Is there something else in the stack trace (or anywhere else) that I'm just totally missing due to my noobishness?