Hi,
After successfully installing cl-opengl, I ran into the following problem when trying to run the examples. I found that the demo's ran without explicit errors, but the output didn't look right. Basically, gl:clear wasn't doing its job.
After some messing around and help from people on #lisp, I found that after (gl:clear :color-buffer :depth-buffer), a (gl:get-error) returned INVALID-VALUE. When removing the :depth-buffer bit, it returned ZERO. When keeping the :depth-buffer and removing the :color-buffer, it returned INVALID-VALUE again. The constants in constants.lisp match those in GL.h, so that shouldn't be the problem.
I'm using SBCL 1.0.28, nvidia binary drivers as well as intel (crappy) drivers. The libGL.so is symlinked to the card that I'm using, and I've verified that when loading cl-opengl, the correct library is used for the card that I'm running.
So this is more of a "is this a bug?" or "help, it doesn't work!" type mail, and am not sure if I should have sent it to devel. However, I didn't know what else to do.
Regards, Sumant
On Tue, Jun 2, 2009 at 5:24 AM, Sumant Oemrawsingh soemraws@xs4all.nl wrote:
After successfully installing cl-opengl, I ran into the following problem when trying to run the examples. I found that the demo's ran without explicit errors, but the output didn't look right. Basically, gl:clear wasn't doing its job.
Can you give us a specific example so that we can try and reproduce the problem?
Hi,
To answer Edward Tate: I'm not using LispBuilderSDL. In fact, I'm not "using" cl-opengl at all at the moment. What I was talking about was, right after installation of cl-opengl running some examples in the source tree to see if it works. So I guess to answer the question properly, I'm using GLUT then.
So I tried two examples: glut-teapot and gears. Both of these suffer from the same problem with gl:clear (i.e. gl:get-errror returns invalid-value when depth-buffer is set). So, here are some details.
For the teapot, what happens is that the window shows the (in)famous teapot, but the background is a copy of the place on my desktop where the window was instantiated, i.e. not black.
For gears, I can't see the gears rotating, because the "teeth" of the gears smear out and cause the gears to have a more wheel-like appearance.
I also had a quick look at render-to-texture, which is... well, weird...
On #lisp, it was suggested that this means that gl:clear doesn't do it's job properly, and that I should see what cl:get-error returns. So I altered the code for the teapot and put a cl:get-error before and after the (cl:clear :color-buffer :depth-buffer), and the error is printed on screen. Result is that before the call to clear, get-error returns zero, but after, it returns invalid-value. So I proceeded to find out which of the two flags is bogus.
Removing :color-buffer and keeping :depth-buffer from the call to cl:clear still returned invalid-value, while removing :depth-buffer and keeping :color-buffer returned zero. So both the original and former calls to cl:clear failed, while the latter succeeded.
Of course, the result is still wrong, because the depth buffer isn't cleared. But at least I know that using (cl:clear :depth-buffer) fails.
I've verified in my GL.h file that the constant for the depth buffer bit matches the one in constants.lisp, so there's no problem there. Also, using lsof, I've verified that when I (require 'cl-opengl) in SBCL, that SBCL indeed uses the correct libGL.so.
Now, when I compile and run glxgears, the C program, it works fine.
I'm not sure where else I can look for more info. I don't think my X logs say anything, and I don't see any error messages when running the (gears) example, nor when running the (glut-teapot) example.
It is highly probable that you won't be able to reproduce this problem, or else, you would have noticed immediately, since it is the examples already that don't work, right? :) If you need more information or there are things you want me to try to debug what's going on, then I'm willing to help. At the moment, though, since the examples don't work, I'm not using cl-opengl, while I really want to.
Thanks, Sumant
On Tue, Jun 02, 2009 at 02:07:27PM +0100, Luís Oliveira wrote:
On Tue, Jun 2, 2009 at 5:24 AM, Sumant Oemrawsingh soemraws@xs4all.nl wrote:
After successfully installing cl-opengl, I ran into the following problem when trying to run the examples. I found that the demo's ran without explicit errors, but the output didn't look right. Basically, gl:clear wasn't doing its job.
Can you give us a specific example so that we can try and reproduce the problem?
-- Luís Oliveira http://student.dei.uc.pt/~lmoliv/
On Tue, Jun 2, 2009 at 11:41 PM, Sumant Oemrawsingh soemraws@xs4all.nl wrote:
It is highly probable that you won't be able to reproduce this problem, or else, you would have noticed immediately, since it is the examples already that don't work, right? :) If you need more information or there are things you want me to try to debug what's going on, then I'm willing to help. At the moment, though, since the examples don't work, I'm not using cl-opengl, while I really want to.
Indeed, I can't reproduce your problem. What version of FreeGLUT are you using? Also, perhaps you can try to call (%gl:clear #x100) and see if that helps.
That's all I can think of right now. HTH.
On Wed, Jun 03, 2009 at 12:39:31AM +0100, Luís Oliveira wrote:
On Tue, Jun 2, 2009 at 11:41 PM, Sumant Oemrawsingh soemraws@xs4all.nl wrote:
It is highly probable that you won't be able to reproduce this problem, or else, you would have noticed immediately, since it is the examples already that don't work, right? :) If you need more information or there are things you want me to try to debug what's going on, then I'm willing to help. At the moment, though, since the examples don't work, I'm not using cl-opengl, while I really want to.
Indeed, I can't reproduce your problem. What version of FreeGLUT are you using? Also, perhaps you can try to call (%gl:clear #x100) and see if that helps.
Hi Luís,
It's solved now. Basically, I was using an old version, not the darcs version... Will you release stable versions again, or is darcs the only place to get it? Anyway, read on if you're interested in what I tried and what I found out.
I'm using freeglut 2.4.0. In both the teapot and gears demo, I replaced
(gl:clear :color-buffer :depth-buffer)
into
(format t "~a~%" (gl:get-error)) (gl:clear :color-buffer) (format t "~a~%" (gl:get-error)) (gl:clear :depth-buffer) (format t "~a~%" (gl:get-error))
which gives
ZERO ZERO INVALID-VALUE
and terrible visual output, the same as with the original call. So I replace the last gl:clear call with
(%gl:clear #x100)
as you suggested. The result is
ZERO ZERO ZERO
and gives me a nice teapot, and nice, fast rotating gears! This appears to work fine!
So I looked again at the source file constants.lisp which seemed fine. However, I suddenly noticed that asdf wasn't using the darcs version I downloaded a few days ago, but an older version 0.1_p20080926 that was installed through my dists package manager! D'oh!
In the old version, :depth-buffer-bit is defined as #x100, but :depth-buffer is defined as #x8223. I removed the old one, and pointed asdf to the new one. Everything works as advertised now!
Sorry for wasting your time.
Sumant
cl-opengl-devel@common-lisp.net