Author |
Topic: 'Bouncy Balls' (BB4W/BBCSDL) (Read 561 times) |
|
meneer
New Member
member is offline


Posts: 5
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #9 on: Feb 22nd, 2017, 07:25am » |
|
David,
The G4 values are quite different than my Moto G4 play variant. (whis is logical as the G4 play is based on the G3 hardware)
CIRCLE FILL command Constant Colour : 262 circles/sec Random colour : 1 circles/sec
Custom filled-circle route Constant Colour : 3295 circles/sec Random color : 3314 circles/sec
My Sony Xperia does it slighty better.
CIRCLE FILL command Constant Colour : 283 circles/sec Random colour : 23 circles/sec
Custom filled-circle route Constant Colour : 4905 circles/sec Random color : 4855 circles/sec
I have tried to load an 32bpp BMP file including the alpha channel using the FNloaddata included in the examples but it doesn't display correctly.
Jeroen
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #10 on: Feb 22nd, 2017, 12:22pm » |
|
on Feb 22nd, 2017, 07:25am, meneer wrote:The G4 values are quite different than my Moto G4 play variant. (whis is logical as the G4 play is based on the G3 hardware)
[...]
My Sony Xperia does it slighty better.
[...] |
|
Thanks for running the test program on your mobile devices.
I should explain that the main purpose of making the filled circle plotter, and the triangle plotter that I will be coding tonight at work, is so that my programs can generate their own simple graphics more efficiently. Although my circle plotter seems faster than BASIC/SDL on Android, it is actually intrinsically very slow for large and partially clipped circles! This is mostly because of the simplistic clipping that it performs; it calculates all the points along the circle edge, even if those points lie outside the viewport. This is very wasteful for large circles. For a circle of 500 pixels radius, it calculates and individually clip-tests all 2*PI*r (3142) points around the circle's edge, whereas a more sophisticated algorithm just 'processes' the visible points of the circle. My triangle/quad plotter will suffer from a similar problem.
Quote:| I have tried to load an 32bpp BMP file including the alpha channel using the FNloaddata included in the examples but it doesn't display correctly. |
|
Most of those sprite/bitmap plotters of mine (which are only experimental), only handle RGB565 bitmaps, so you would load in your 32bpp BMP image using (for example) FNLoadData, and then convert it to the required RGB565 format (which ignores your alpha mask!), or to 32bpp ARGB8565 (8 bits alpha, 5 bits red, 6 green, 5 blue) which can be plotted using PlotAlphaBlend (which I haven't yet released). I will post some example code in a few hours.
I should point out that my little graphics library, aimed primarily at Android, is an absolute pig to use, and I really don't recommend it unless you have masochistic tendencies. I couldn't figure out how to pass parameters to my ARM machine code routines using BASIC's CALL command, as in:
CALL PlotSprite, bufVars%, bmAddr%, bmW%, bmH%, x%, y%
I know it must be possible, because that's how the ARM binary version of SORTLIB works.
I'm not having much luck with SYS either!
I know it's early days, and perhaps documentation will come our way at some point, although some of the signals coming from Richard recently in regard to the future development of the Android edition of BBCSDL makes me wonder if it's worth continuing my own explorations with it.
I'll post some code shortly.
David. --
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #11 on: Feb 22nd, 2017, 1:51pm » |
|
Jeroen,
Here is some example code for loading in a BMP32 bitmap image (with alpha mask), and plotting it using 'PlotAlphaBlend':
http://pastebin.com/uukx85QJ
You will need the 72x72 BMP32 test image:
http://www.proggies.uk/temp/ball72x72.zip
The Zip folder also contains the example program and the original PNG image that I converted to BMP32. The PNG image came from openclipart.org .
As you can see, quite a bit of faffing around is needed just to plot some sprites. Sorry about that!
BTW, I should have mentioned in the program somewhere, that the width and height of a BMP image can be obtained by reading the 32-bit values at offsets 18 and 22 in the BMP header. In the case of the example program:
ballW% = ball%!18 ballH% = ball%!22
EDIT: Here's a slightly modified version of the example program which plays around with the BMP's alpha mask to produce a 'fuzzy' effect:
http://pastebin.com/c8Z7tJLH
David. --
|
|
|
|
meneer
New Member
member is offline


Posts: 5
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #12 on: Feb 23rd, 2017, 12:38pm » |
|
David,
I have succesfully managed to read 32bit BMP files with Alpha values. Thanks.
I will make some demo to see if I can make a scrolling gaming field filled with tiles.
Cheers, Jeroen
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #13 on: Feb 23rd, 2017, 8:26pm » |
|
Demo of filled triangle plotting routine, intended for BBCSDL (Android), but works with BB4W:
http://pastebin.com/h2m70R9Q
Compare performance (especially on Android) with this version which uses BASIC's PLOT 85 to draw the triangles:
http://pastebin.com/xp89yEgs
In the case of BBCSDL (Android), my plotter seems hundreds of times faster (at least on my Moto G4), even though it's actually very inefficient.
David. --
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #14 on: Feb 24th, 2017, 4:44pm » |
|
Semi-transparent triangles (random opacities):
http://pastebin.com/JMCjPtUZ
To do: quad poly plotter, thick line plotter, bitmap supersampling code, image blur, and lots of other bits and pieces.
Hopefully Richard will at some point implement SYS for the ARM variant of BBCSDL for calling machine code routines, so that parameters can be pulled off the stack as with the x86 version of BB4W. In ARM BBC BASIC V (etc.), the SYS statement loads parameters directly into selected registers, which is usually very convenient.
David. --
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #15 on: Feb 24th, 2017, 8:37pm » |
|
Semi-transparent triangles & circles over a colourful background. Works nicely on my Android phone (Motorola Moto G4).
http://pastebin.com/cK3GMipJ
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #16 on: Feb 25th, 2017, 12:53am » |
|
Same program as previous, but now with an FPS indicator.
http://pastebin.com/ZKnKBjaR
I get 32 fps (average) on my Moto G4, which isn't bad considering that all the graphics is software-rendered (no hardware acceleration) on a relatively slow processor. More efficient colour-blending code (for both x86 and ARM architectures) ought to at least double the speed of the rendering.
David. --
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #18 on: Mar 3rd, 2017, 11:17pm » |
|
Rotating blue flowers (x86 & ARM bitmap rotation test):
http://pastebin.com/uS3Yqvgs
Tested under BB4W, BBCSDL Win32, BBCSDL Android (ARM).
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #21 on: Mar 9th, 2017, 08:39am » |
|
Continuing my development of a little software graphics library for a possible Android game project, here's a flood fill demo (the 'flower' shape is flood-filled in real-time). Very sub-optimal (especially for ARM processors), but fast enough for my needs.
http://pastebin.com/keXeYHs4
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: 'Bouncy Balls' (BB4W/BBCSDL)
« Reply #22 on: Apr 11th, 2017, 12:35am » |
|
The following YouTube video is a summary of my experiments with BBCSDL on an ARM-based Android device. Something seems to be messing up the colour gradients (possibly with the video capture software which I downloaded minutes before making the video!). There is some inevitable 'colour banding' due to the reduced colour bit depth imposed by SDL (16bpp as opposed to the usual 24- or 32bpp), but something went very wrong and the colour banding/quantization problem isn't actually as bad as what is portrayed in the video.
https://youtu.be/C2vl-bN5OnE
|
|
Logged
|
|
|
|
|