|
Forum Index : Microcontroller and PC projects : Kaleidoscope
| Author | Message | ||||
| William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405 |
Here is a little demo program that uses 8-fold symmetry with random triangles and colors to produce a nice kaleidoscope effect. -Bill Kaleid.zip |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10588 |
Like it But for the full effect add page write 2 cls circle mm.Hres\2,mm.Vres\2,mm.vres\2-20,,,,rgb(white) page write 1 cls at the top and replace the pause 200 with Polygon 3, xv(), yv(),, c page and_pixels 2,1,1 page copy 1 to 0,b pause 50 at the bottom |
||||
| William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405 |
Ooh, excellent! I was considering adding circles but was too lazy to do it. I didn't do the offscreen write and blit because the flashing did not appear to be annoying. -Bill |
||||
| William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405 |
Attached is version 1.1.0 of Kaleid. It clips the overall image to be contained in a large circle, which enhances the kaleidoscope effect. This change was suggested by Peter Mather, who kindly provided the code snippets to implement this. -Bill Kaleid.zip |
||||
| William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405 |
I notice that on my CMM2, after adding the circle clipping, there is a randomly-occuring "twitch" that happens. This looks like all the graphics moving suddenly to the side for a few milliseconds and then it is stable. This did not happen in my original version, so it definitely is the result of adding the clipping circle. I am guessing that the problem is (somehow) in the page copy. I experimented a little, and I find that changing the pause from 50 to 60 ms greatly reduces the problem but does not entirely eliminate it. A further increase in the delay does eliminate the problem but impairs the overall kaleidoscope effect, at least to my taste. Of course, I don't know whether this problem is unique to my CMM2 or is general. Peter, can you give me any clues as to the root cause and whether this can be fixed without lengthening the delay more? Thanks! -Bill |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4147 |
Sounds like the kind of video artefact caused by a refresh (frame) rate & (software) drawing rate which are not synced. E.g. say refresh is 75Hz (13.3ms) and you use 50 or 60ms then you wouldn't get a whole number of refreshes per 50 or 60ms. John Edited 2020-11-14 22:44 by JohnS |
||||
| William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405 |
That is what I think, too, John. However, isn't the "b" option on PAGE COPY supposed to handle that? -Bill |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10588 |
You need to sync the PAGE AND_PIXELS to frame blanking as well as the copy. Because you are using mode 1,16 the video is reading from the SDRAM, the PAGE AND_PIXELS is also hammering SDRAM dim frame=0 mode 1,16,0,myint ..... frame=0 do: loop while frame=0 page and_pixels 2,1,1 ..... sub myint frame=1 end sub |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4147 |
Thanks, Peter! William, Just to add to Peter's snippet, set frame=0 again once the main program has detected it's not 0 (in that do: loop while frame=0 code). John |
||||
| William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405 |
Oh great! That fixes the problem! It all makes sense now. Using that ISR to help synchronize the memory-intensive ops is a neat trick. Attached is Rev 1.1.1 of Kaleid that has Peter's fix for video glitches. -Bill Kaleid.zip |
||||
| epsilon Senior Member Joined: 30/07/2020 Location: BelgiumPosts: 255 |
Very nice! It's still a bit glitchy for me but I think that's because I really should be installing that crystal oscillator mod to calm down my HSync signal. Imagine if we could get a whole demoscene going on CMM2. It was actually the youtube video of Mauro's demo that got me into CMM2 in the first place. Epsilon CMM2 projects |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |