[Kde-games-devel] Ksudoku, Kubrik 3D background

Ian Wadham ianw2 at optusnet.com.au
Sat Jun 21 03:43:13 CEST 2008


On Sat, 21 Jun 2008 02:39 am, Matthew Woehlke wrote:
> Ian Wadham wrote:
> > What is going on?  Will the real gluOrtho2D please stand up?
>
> D'oh! I see the problem now; that's even more subtle and trivial than I
> thought. Try reversing your winding order on the quad :-D. I'll also bet
> that mine "stops working" if you reverse the winding order.
>
Yep!  I must have been using clockwise order of rectangle vertices when
I was trying out gluOrtho2D, though I have deleted that code now and will
never know for sure.  That would have made my rectangle the "back" face
and therefore invisible!

Luckily I used anti-clockwise order in my 3-D version of background
rendering.  I remember now that I had some trouble 2 years ago
(when I wrote the cube-drawing code), getting all the facets to be
drawn in anti-clockwise order, looking inward, thus making them all
appear to be on the "outside" of the cubes.

In Kubrick, using GL_CULL_FACE saves some drawing time and I think
glColorMaterial (GL_FRONT, ...) does too.  Another saving is that interior
cubies are not drawn (e.g. the middle 4x4x4 part of a 6x6x6 cube).  All
this adds up to reasonably good performance without acceleration
in hardware.

Given all the 3-D complexities that still exist if you draw in "2-D" in
OpenGL, maybe that is why Trolltech advise people to use QPainter to
do 2-D drawing on a QGLWidget ... :-)

All the best, Ian W.



More information about the kde-games-devel mailing list