Image Processing in BBCSDL / Linux

Discussions related to graphics (2D and 3D), animation and games programming
TonyTooth
Posts: 7
Joined: Mon 07 Aug 2023, 18:37

Image Processing in BBCSDL / Linux

Post by TonyTooth »

Having recently taken the plunge to try out Linux I thought I'd also try BBCSDL. I've written a lot of image processing programs in BBC4W with ASM over the years. Could I do similar in BBCSDL?

Well - it's honestly been the longest headache; it's taken me 3 whole days to:

1/ get my head around SDL Surfaces vs Textures.

2/ find a list of the actual values for the SDL_PIXELFORMAT enumerations online: (https://pub.dev/documentation/dart_sdl/ ... ormat.html)

3/ find where the actual pixel data is in the Surface.

4/ adapt Richard's IMGLIB to return the Surface as well as the Texture and to create a revised Texture from the revised Surface with the pixels converted to greyscale.

Haven't done it in ASM yet - but that'll be the easy bit...
Hated Moron

Re: Image Processing in BBCSDL / Linux

Post by Hated Moron »

TonyTooth wrote: Mon 07 Aug 2023, 18:59 Having recently taken the plunge to try out Linux I thought I'd also try BBCSDL. I've written a lot of image processing programs in BBC4W with ASM over the years. Could I do similar in BBCSDL?
I would suggest you take a look at the gfxlib.bbc library for BBCSDL, which does a fair amount of image processing in a fully cross-platform fashion (so no assembler code).

It does as much as possible using textures, so advantage can be taken of GPU acceleration to obtain a performance that could only otherwise be achieved using assembler code.

Surfaces are only used for Collision Detection, which as a result is somewhat slower than would be desirable (particularly pixel-accurate collision detection).

The library is documented here so that may be a helpful resource. What kinds of image processing do you want to do that aren't already catered for by this library?

If you want a challenge, porting your existing assembler routines to shader (GPU) code would most likely achieve a speed you couldn't otherwise dream of, plus being cross-platform! The conway.bbc example program would be a good starting point.