[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Debugging desaster



Gregor Mückl wrote:

It produces bad results - a crash would be far more trivial to debug :-)

I assumed as much.

* You are somehow creating your matrix from Euler rotation angles
  and you are concatenating those rotations in the wrong order.
  Once again, things would only go wrong when you rotated...but this
  error tends to be more subtle because rotating around any ONE axis
  would work - and rotation about two or more axes would produce
  subtle errors for small angles of rotation that grow rapidly as
  the angles get larger.

Hm... I only see the deviation when I start to rotate the camera around the local x- and y-axes. rotations around the local z-axis are fine as are translations along all three axes.

That's the right symptoms for this kind of bug.

This is quite close to what I actually see here. But I'm not usin Euler angles to construct the full modelview matrix. I'm converting mouse movements to angles in camera-local coordinates and construct rotational matrices from them,

...the mouse coordinates are being converted to angles - and you are using the angles to create matrices. That's what I'm telling you is likely to be at fault.

My FAQ might help:

  http://www.sjbaker.org/steve/omniv/eulers_are_evil.html

Anyway, the bug still shows when using gluUnproject, which doesn't help me at all for a change. I'm really running out of ideas about what to check next.

Yeah - but if the matrices you are feeding it are wrong...

Yesterday I didn't properly point out the position of the Moonlight sourcecode in my repository which has grown quite a bit over time already. The correct URL is http://www2.futureware.at/svn/gregor/Moonlight. Well, I shouldn't write emails at 4 o'clock in the morning when I'm about to fall asleep in front of the keyboard.

I don't really have the time/inclination to dive in and look at it - but maybe this advice will help you get going.

I deeply sympathise - fixing problems with angles, matrices and such are
the amongst the hardest things to get right.

---------------------------- Steve Baker -------------------------
HomeEmail: <sjbaker1@xxxxxxxxxxx>    WorkEmail: <sjbaker@xxxxxxxx>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net    http://tuxaqfh.sf.net
           http://tuxkart.sf.net http://prettypoly.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----