[cl-opengl-devel] Some issues porting an example from nehe.gamedev.net

Malcolm Reynolds malcolm.reynolds at gmail.com
Mon Oct 5 21:10:36 UTC 2009


> Right, you probably need to enable a depth buffer, and you probably
> also want double buffering on modern platforms, both are controlled by
> the :mode parameter to glut:window instance creation, easiest way to
> fix that is changing the ":mode '(:single :rgb)" in the (defclass
> test-window ...) form to ":mode '(:double :rgb :depth)".
>
> If you switch to double buffering (using :double instead of :single
> there), you will also need to do (glut:swap-buffers) after drawing
> each frame, probably in place of the (gl:flush) in the glut:display
> method.

Lovely. This is now working properly, thankyou!

> You may also want to get rid of the (glut:post-redisplay) in the
> keyboard method, since that kills my lisp when i try to exit the
> window (yay for C libraries that think exit() is a good response to
> unexpected situations)

Okay. Is putting #'glut:post-redisplay into my method on #'glut-idle
the preferred way (or at least, not a discouraged way) of keeping the
model updating?

One final difference between my two versions is that resizing the
window on the lisp version scales the inside accordingly (squares
become squashed) which doesn't happen on the C version. Obviously this
is a bit more of an involved question, but the part that will make
this happen is in the #'glut:reshape method, correct?

Many thanks for your quick reply!

Malcolm




More information about the cl-opengl-devel mailing list