My first multi cog renderer...
Bamse
Posts: 561
Just want to say thanks to J.T. Cook who supplied me with the original code.
I modified his driver and made it a 47x30 tile engine with a "hi-res" of 376x240 pixels in NTSC.
So there are a few columns/rows wasted since they are rendered outside the visible screen.
Next up, document the whole project and make it into a tutorial in multi-cog rendering...
Edited 8/10 2008,
Here is the whole tutorial zipped into one file. For some reason I cannot upload a .zip file so you have to rename it yourself...
This is pretty weird since I know I have uploaded zip file earlier...
This version does have the sprite moving in both X and Y positions...
Edited 8/26 2008,
Finished coding and first draft...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/27/2008 4:49:32 AM GMT
I modified his driver and made it a 47x30 tile engine with a "hi-res" of 376x240 pixels in NTSC.
So there are a few columns/rows wasted since they are rendered outside the visible screen.
Next up, document the whole project and make it into a tutorial in multi-cog rendering...
Edited 8/10 2008,
Here is the whole tutorial zipped into one file. For some reason I cannot upload a .zip file so you have to rename it yourself...
This is pretty weird since I know I have uploaded zip file earlier...
This version does have the sprite moving in both X and Y positions...
Edited 8/26 2008,
Finished coding and first draft...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/27/2008 4:49:32 AM GMT
Comments
I was working on the same project.. but with low resolution and in PAL mode (256x256).. 8x8·pixels per tile, 32x32 tiles.
Do You will insert a sprites·render on your driver?
I'm waiting for your new tutorial!
thanks.
gabriele
only issue is you're losing pixels, with the high resolution, well on my lcd it is.
also, left two pixels are a pixel down for some strange reason?
maybe it's the delay between the copying of the new bytes to the scanline.
Baggers
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
also, I'm running it on hybrid, which is at 96Mhz, so it could be the timing on the scanline update.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
Yes, I plan to add sprites and smooth scrolling, but it will probably take the rest of the week to get the tutorial done..
So I will not start that work until next week and then expand the tutorial as I add new features.
@Baggers,
I'll bring out the camera later today for some exciting screenshots...
However this TV driver should theoretically support the screen shot driver, I'll have to look into this...
Does your LCD TV display all pixels ?
My TV looses about 2 top and bottom rows and 3 columns on the left and right.
This was done intentionally to avoid side effects like that...
My good old trusty CRT can display about 40x25 of the 47x30 tiles.
The resolution of 376 pixels is 188x2, which is twice the resolution of NTSC.
So I think you can generate some extra colors that are not part of the 86 colors native to the Hydra.
Do this by putting two pixels with different colors next to each other to blend them in.
I've read about this somewhere else in the forum and just wonder if anyone remember that link...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
More are possible as I avoided using the higher saturation ones. Can easily get 9 bits of color resolution with that technique. The downside is it really should utilize a lookup table, so the colors make some sense. That's costly in terms of COG time and space. Maybe in a multi-cog scenario, the main render COG, can do this, leaving the others to build tiles, sprites and such...
One thing to watch for is your left overscan needs to be a multiple of 16 clocks to keep the PLL timing consistent. If this is not done, then the actual colors you get from the mix will vary on each start. There is a thread on this, where Jasper_M helped me out with the original demo code that illustrated the idea.
Looking forward to your tutorial as well. I've not yet done much with more than one COG. Your last one was just clear and very well done.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Let me see if I can add my previous tutorial.
Maybe a lookup table with 256 colors on-screen would be possible...
However my driver is pretty costly as is, it's using 4 render cogs to just be able to feed the TV driver so I'm already using 5 cogs just for graphics...
I don't use any borders, I just start pushing out the pixels right after the sync.
The sync is 624 clocks (16x39) and my pixels (4 at the time) uses 32 clocks so I should be OK to combine colors.
That does not explain why Baggers are seeing the distorted pixels though...
This is more of a tutorial so I think I'm going to live with these issues and have an easier code to read rather than optimizing it.
I might have to lower the resolution when adding sprites to make sure I don't run out of cogs but that's a later problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Concentrate on understanding the problem, not applying the tool
I'm glad you like the tutorial.
I have attached a draft of the tutorial I'm working on, it should answer a few of your questions.
Just been a little bit distracted lately but I'm going to continue work on it this week...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/10/2008 7:18:11 AM GMT
and now I'll wait sleepless for·the render driver code! [noparse]:)[/noparse]
See if I can do that tomorrow.
I added the first part of the multi-cog render system, still got a few more parts to add to the tutorial...
Here is a sneak preview of the code though...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/10/2008 7:18:28 AM GMT
the render starts only after the sync.. the cog number and the internal scanline number,·are the counters to find with the map pointer the correct
tile.. you fit·all the·colors\tile bytes in longs in a internal memory array (scan buffer res 94) ..
2 per cycle (8 pixels) and you you move to the next tile\color hex value. When the scanline is completed
starts the cycle that stop the cog until the caller, the driver, set the correct global scaline number in memory..
then the render updates the global scanline array to show and the internal scanline number for his next row.. then loop..
Is the logic correct?
Have you any other·preview with sprites·and smoth scrolling to post?
thanks a lot!
·
The sprite and smooth scrolling will be part 2 of this tutorial, I'm still working on the first part...
Here is the current draft without screen shots, looks like the screen shots take up about 90% of the document...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/10/2008 7:18:57 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/10/2008 7:19:19 AM GMT
1) deleted the first "wrlong· current_scan_line_internal, scan_line_ptr"
2) moved current_scan_line_internal reset before user graphics line generation
·now the left 2 pixels are ok on my tv.
·
Can you post the whole code ?
I kind of know what you changed but it's easier if you would post the whole source...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
I should be able to proof read it tomorrow to catch the worst mistakes and then I wonder if someone cold take a look at it to correct my not so perfect English...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/10/2008 7:19:49 AM GMT
I've changed your last drv preview file.. My video driver (where I fixed the problem) is a little bit different.
Try it before.
http://www.ilpuntosrl.com/download/propeller/BAM_Tile_Graphic_DRV_01.zip
I got bored with the proof reading and finished off the smooth scrolling...
So here is another preview...
Control the map with the control pad and hit the B-button for a new random map...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/10/2008 7:20:03 AM GMT
and the code is clear too..
We're using 5 cogs for the render now, do you think we'll need another one for the sprites?
·
These drivers are educational, not optimized. Hopefully you can use these drivers as a template and then optimize them.
I would suggest using a smaller resolution for example, this driver renders outside the visible screen which waste processing time.
Anyhow, I've decided not to make it a two part tutorial and add smooth scroll and sprites to the current tutorial...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
So far only the y position is implemented, the x position will be the next driver...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Post Edited (Bamse) : 8/10/2008 7:20:19 AM GMT
Andre'
I also want to be able to set the sprite size in the parameter block.
I'm just trying to keep it simple and add features as I go along with the tutorial...
This driver is far from optimized and once I'm done I'll probably start from scratch and write the driver I really want...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
Almost there, the sprite moves on both the X and the Y axis now...
Next up is clipping and programmable sprite size...
That should be it, after adding that section I will start the proof reading again for the 9047th time...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
I skipped the scaling but included clipping and I'm considering this my first draft...
Anyone care to proof read it ???
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
Only thing I did find was a typo, in TIP section on page 3, "Since the video driver need to be able" should be needs, not need, "Since the video driver needs to be able",
So considering that's the only thing I did find, I'd say Job well done matey [noparse]:)[/noparse]
Baggers
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
I was just worried that any Swedish had made it's way in there...
I'm going to update the document, find somewhere to host it and start a new thread specifically for the Tutorial...
Now I can move on to another project I started way ago and never got to finish...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·