Hi all,
To do some effects (sinus deformations, rotate, blur, zoom ... ) i would change dynamically the pixels sprite datas on runtime ...
what method ?
have you a simple sample code ?
Thanks
dynamically change pixel sprite
Moderator: Stef
-
- Very interested
- Posts: 86
- Joined: Fri Sep 25, 2015 4:16 pm
Re: dynamically change pixel sprite
I don't know if SGDK has a function for it, but in the end what you're doing is writing to VRAM, and your sprites will show the relevant tiles.
If you are doing software rendering you should keep a buffer in 68k memory, draw to it, then DMA it to a location in VRAM.
I think SGDK provides bitmap functions (bitmap.h). Because of how memory is organized, by the way, you will want to use multiple 1-cell height sprites instead of any taller ones, because otherwise you're going to have to mangle the arrangement of the tiles in VRAM.
Be sure you aren't doing too many effects like this. All of those effects you described will be extremely slow. If you can pre-calculate them, you should.
If you are doing software rendering you should keep a buffer in 68k memory, draw to it, then DMA it to a location in VRAM.
I think SGDK provides bitmap functions (bitmap.h). Because of how memory is organized, by the way, you will want to use multiple 1-cell height sprites instead of any taller ones, because otherwise you're going to have to mangle the arrangement of the tiles in VRAM.
Be sure you aren't doing too many effects like this. All of those effects you described will be extremely slow. If you can pre-calculate them, you should.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: dynamically change pixel sprite
When you want to do some pixel based effects (rotation, blur, ...) i highly recommend you to use the SGDK bitmap engine :
https://github.com/Stephane-D/SGDK/blob ... /inc/bmp.h
Everything is done in software as natively the megadrive does not support bitmap mode.
Note that for performance and memory limitation reasons the bitmap resolution is limited to 256x160 and just blitting the bitmap buffer to VRAM will not allow more than 20 FPS on NTSC and 25 FPS on PAL.
https://github.com/Stephane-D/SGDK/blob ... /inc/bmp.h
Everything is done in software as natively the megadrive does not support bitmap mode.
Note that for performance and memory limitation reasons the bitmap resolution is limited to 256x160 and just blitting the bitmap buffer to VRAM will not allow more than 20 FPS on NTSC and 25 FPS on PAL.
Re: dynamically change pixel sprite
Thx guys