Closed dto closed 13 years ago
Isn't this an SDL error? Do the cl-glut examples work?
Sorry for posting here if it is the wrong place, but I seem to have the same problem, and I really can't to find anything else.
Did you ever find any solution to this?
After some digging I had the following program:
(ql:quickload "cl-opengl")
(ql:quickload "lispbuilder-sdl")
(defun main ()
(sdl-cffi::sdl-init sdl-cffi::sdl-init-video)
(sdl-cffi::sdl-gl-set-attribute :sdl-gl-red-size 8)
(sdl-cffi::sdl-gl-set-attribute :sdl-gl-green-size 8)
(sdl-cffi::sdl-gl-set-attribute :sdl-gl-blue-size 8)
(sdl-cffi::sdl-gl-set-attribute :sdl-gl-doublebuffer 1)
(let ((surface (lispbuilder-sdl-cffi::sdl-set-video-mode 320 240 32 18)))
(if (cffi:null-pointer-p surface)
(format t "surface is null: ~a~%" (sdl-cffi::sdl-get-error))
(format t "got a surface~%")))
(sdl-cffi::sdl-quit))
(main)
$ sbcl --load sdl.lisp
.....
surface is null: Couldn't find matching GLX visual
Now, if I remove the line
(ql:quickload "cl-opengl")
I suddenly get
$ sbcl --load sdl.lisp
.....
got a surface
Does anyone have any suggestion on where to continue form here?
If I remember correctly, the problem was a broken /usr/lib/libGL.so
symlink. Reinstalling video drivers might help, or maybe fix the link by hand if that is the problem and you can tell what it should be.
Indeed, that did solve the problem.
I'm just a bit puzzled as to why it failed when cl-opengl was loaded and succeeded when when it wasn't. And, also, I didn't have any problem with non-lisp programs accessing SDL and OpenGL.
Thanks anyway.
non-lisp programs are probably linked against a more specific version rather than to the generic .so
. It might have broken similarly if you had compiled something from source. Not sure exactly what happens when just lispbuilder-sdl is loaded, possibly libSDL loads a different lib if one isn't loaded already.
If the libGL.so symlink was broken, shouldn't cl-opengl have signalled an error when trying to load it?
not quite that broken (or maybe just more subtly broken)... it points to a valid .so, just not the right one :/
On my system /usr/lib/libGL.so points to /usr/lib/mesa/libGL.so and not /usr/lib/nvidia-current/libGL.so, so obviously it's a valid .so but not the right one.
Also I see that SDL loads libGL.so.1, which corresponds to /usr/lib/nvidia-current/libGL.so.1, while cl-opengl by default tries to load libGL.so. Either removing libGL.so from cl-opengl's list of libraries or fixing the link in /usr/lib/libGL.so solves the problem.
Thanks.
(Now the question is why Ubuntu doesn't have the correct link when I have installed the nvidia driver... hehe)
I'm using CL-OPENGL with LISPBUILDER-SDL on two different machines--- a tablet pc with intel cpu/gpu, and a larger beefy media PC with an AMD processor and a pretty decent NVIDIA card. 3D acceleration works fine, and other Opengl stuff (screensavers, games etc) works,
but I cannot run any of the CL-OPENGL examples or my own code, I always get the backtrace shown below.
Indeed the single test expression (sdl:window 640 480 :opengl t) fails. I'll try playing with NVIDIA opengl options some more, Luke Crook suggested it might be color depth issues but I did not have immediate success in changing those.
Other data: (sdl::video-driver-name) => "x11" ;;; this is also its value on the other machine, where it works fine (sdl-cffi::sdl-get-error) => "Couldn't find matching GLX visual"
Let me know if there is any more i can do to help diagnose the issue.
Here's the backtrace:
The value NIL is not of type SYSTEM-AREA-POINTER. [Condition of type TYPE-ERROR]
Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [*ABORT] Return to SLIME's top level. 2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {B4022F1}>)
Backtrace: 0: (LISPBUILDER-SDL-BASE:SURF-W NIL) Locals: SB-DEBUG::ARG-0 = NIL 1: ((SB-PCL::FAST-METHOD LISPBUILDER-SDL::GET-RECTANGLE-* (LISPBUILDER-SDL:SDL-SURFACE)) # # #<LISPBUILDER-SDL::DISPLAY {B9D16F9}>)
Locals:
SB-DEBUG::ARG-0 = :
SB-DEBUG::ARG-1 = :
SB-DEBUG::ARG-2 = #<LISPBUILDER-SDL::DISPLAY {B9D16F9}>
2: ((SB-PCL::FAST-METHOD (SETF LISPBUILDER-SDL:CELLS) (INTEGER LISPBUILDER-SDL:SDL-SURFACE)) # # 1 #<LISPBUILDER-SDL::DISPLAY {B9D16F9}>)
Locals:
SB-DEBUG::ARG-0 = :
SB-DEBUG::ARG-1 = :
SB-DEBUG::ARG-2 = 1
SB-DEBUG::ARG-3 = #<LISPBUILDER-SDL::DISPLAY {B9D16F9}>
3: ((SB-PCL::FAST-METHOD INITIALIZE-INSTANCE :AFTER (LISPBUILDER-SDL::DISPLAY)) ..)
Locals:
:ANY-FORMAT-DEFAULTING-TEMP = NIL
4: ((SB-PCL::EMF INITIALIZE-INSTANCE) ..) Locals: SB-PCL::.ARG0. = #<LISPBUILDER-SDL::DISPLAY {B9D16F9}> SB-PCL::.DFUN-MORE-CONTEXT. = -310626811 SB-PCL::.DFUN-MORE-COUNT. = 20 5: ((SB-PCL::FAST-METHOD INITIALIZE-INSTANCE :AROUND (LISPBUILDER-SDL::FOREIGN-OBJECT)) ..) Locals: SB-PCL::.NEXT-METHOD-CALL. = #S(SB-PCL::FAST-METHOD-CALL ..) SB-PCL::.REST-ARG. = (:FPS #<LISPBUILDER-SDL:FPS-MIXED {B9298C1}> :FLAGS 2 :TITLE-CAPTION ..) LISPBUILDER-SDL::SELF = #<LISPBUILDER-SDL::DISPLAY {B9D16F9}> 6: ((SB-PCL::FAST-METHOD MAKE-INSTANCE (CLASS)) # # # #<unavailable &REST argument>)
Locals:
CLASS = #
SB-PCL::INITARGS = :
7: ((SB-PCL::FAST-METHOD LISPBUILDER-SDL:WINDOW (T T)) ..)
Locals:
LISPBUILDER-SDL:HEIGHT = 480
REST = (:FPS #<LISPBUILDER-SDL:FPS-MIXED {B9298C1}> :FLAGS 2 :TITLE-CAPTION ..)
LISPBUILDER-SDL:WIDTH = 640
8: (IOFORMS::RUN-MAIN-LOOP)
[No Locals]
9: (IOFORMS:PLAY "example2")
Locals:
IOFORMS:PROJECT = "example2"
10: (SB-INT:SIMPLE-EVAL-IN-LEXENV (IOFORMS:PLAY "example2") #)
Locals:
SB-DEBUG::ARG-0 = (IOFORMS:PLAY "example2")
SB-DEBUG::ARG-1 = #
11: (EVAL (IOFORMS:PLAY "example2"))
Locals:
SB-DEBUG::ARG-0 = (IOFORMS:PLAY "example2")
--more--
I inspected the DISPLAY object:
<LISPBUILDER-SDL::DISPLAY {B9D16F9}>
Class: #
Group slots by inheritance [ ] Sort slots alphabetically [X]
All Slots: [ ] CELL-INDEX = 0 [ ] CELLS = NIL [ ] DISPLAY-SURFACE-P = T [ ] FOREIGN-POINTER-TO-OBJECT = NIL [ ] FREE-FUNCTION = #<FUNCTION (LAMBDA (LISPBUILDER-SDL:FP)) {C4958ED}> [ ] GARBAGE-COLLECT = NIL [ ] POSITION-RECT = #<LISPBUILDER-SDL:RECTANGLE {BA8D699}>