FS#9380 - spacerocks shows funny rocks

Attached to Project: Rockbox
Opened by Frank Gevaerts (fg) - Monday, 08 September 2008, 19:46 GMT
Last edited by Teruaki Kawashima (teru) - Saturday, 12 December 2009, 14:11 GMT
Task Type Bugs
Category Games
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Sometimes the rocks shown have wrong edges (see screenshots). The lines jump between different points while rotating.

I've seen this on H100, H300 and X5
   rocks1.jpg (229.4 KiB)
   rocks2.jpg (252.5 KiB)
This task depends upon

Closed by  Teruaki Kawashima (teru)
Saturday, 12 December 2009, 14:11 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in r23944.
Comment by Nils Wallménius (nls) - Friday, 03 October 2008, 08:25 GMT
Hi, I committed a fix to the 16 bits lcd driver which fixed one problem with spacerocks in the sim but i have been unable to reproduce this on target.
Comment by Frank Gevaerts (fg) - Wednesday, 08 October 2008, 19:00 GMT
It's not fixed in r18691 (your lcd fix)
Comment by Nils Wallménius (nls) - Thursday, 09 October 2008, 16:52 GMT
Yes, I was able to reproduce this on my h300 finally.
I tried letting it run in the h300 sim for a long while too and observed an interesting effect, some of the rocks keep increasing in size and get so big they are mostly outside the display all the time.
Comment by Tomer Shalev (tomers) - Thursday, 09 October 2008, 18:44 GMT
> some of the rocks keep increasing in size and get so big they are mostly outside the display all the time.

This happens due to the way the rock's vertices are being rotated. There is an accumulating error which affects the shape of the rocks.

The reason is due to the way the vertices are being sined and cosined, by being multiplied with a constant of a four digits accuracy.
The error is not being reset at all, even if the asteroid completes a full round...

See code at:

I'm developing a new game, partly based on spacerocks, and I fixed this error in my code. When I find the time, I'll fix spacerocks either.
If anyone is interesting, I can attach my draft code here.
Comment by Nils Wallménius (nls) - Monday, 20 October 2008, 19:12 GMT
Tomer, if you would post your work somewhere and point out what the fix is I could try to incorporate it into spacerocks.
Btw I reproduced this on my Gigabeast so the title was incorrect, and will be changed soon.
Also I noted that the rocks first got bigger and then turned into funny shapes so it seems related.
Comment by Teruaki Kawashima (teru) - Thursday, 10 December 2009, 14:41 GMT
I made a fix for this issue. this seems to work to me on my gigabeat x.