Here's a little blast from the past which I've just rediscovered hiding on a hard drive:
http://www.proggies.uk/gfxlibdemos/prog ... wdx9fs.zip
It's probably best to extract the EXE file from the zip folder before running, or your Windows/AV combination might refuse to run it.
Click mouse to exit.
Rotating blurry thing (BB4W + GfxLib)
-
- Posts: 177
- Joined: Mon 02 Apr 2018, 21:51
Re: Rotating blurry thing (BB4W + GfxLib)
To be honest I don't see the point of posting these things here if you're not including the source code.
Re: Rotating blurry thing (BB4W + GfxLib)
I have some sympathy with that viewpoint, but in the case of such a simple example isn't there perhaps just as much interest and challenge in reproducing something similar from scratch without having somebody else's source code to copy? It took me no more than ten minutes to create this (admittedly poor in comparison with David's) BBCSDL version; it may be tricky to improve on it greatly given SDL's 8-bit alpha resolution.
Code: Select all
SYS "SDL_SetWindowFullscreen", @hwnd%, &1001
VDU 26
IF POS REM SDL thread sync
WinW% = @vdu%!208
WinH% = @vdu%!212
DIM Dst{x%, y%, w%, h%}
tex%% = FNloadtexture(@dir$ + "BBCSDL_spectrum.png")
SYS "SDL_SetTextureBlendMode", tex%%, 1
SYS "SDL_SetTextureAlphaMod", tex%%, 8
REPEAT
angle# = 360*SIN(TIME/1100)
scale = 1 + 3.0 * ABSSIN(TIME/200)
Dst.w% = WinW% * scale
Dst.h% = WinW% * scale
Dst.x% = (WinW% - Dst.w%) DIV 2
Dst.y% = (WinH% - Dst.h%) DIV 2
IF @platform% AND &40 THEN
IF angle#=0 ?(^angle#+7)=&80
SYS "SDL_RenderCopyEx", @memhdc%, tex%%, FALSE, Dst{}, angle#, FALSE, FALSE
ELSE
SYS "SDL_RenderCopyEx", @memhdc%, tex%%, FALSE, Dst{}, !^angle#, !(^angle#+4), FALSE, FALSE
ENDIF
*REFRESH
MOUSE X%, Y%, B%
UNTIL B% OR INKEY(0) <> -1
QUIT
DEF FNloadtexture(file$)
LOCAL s%%, t%%
SYS "STBIMG_Load", file$ TO s%%
IF @platform% AND &40 ELSE s%% = !^s%%
IF s%%=0 ERROR 104, "Unable to load image: " + file$
SYS "SDL_CreateTextureFromSurface", @memhdc%, s%% TO t%%
IF @platform% AND &40 ELSE t%% = !^t%%
IF t%%=0 ERROR 105, "Unable to create texture: " + file$
SYS "SDL_FreeSurface", s%%
= t%%
You do not have the required permissions to view the files attached to this post.
Re: Rotating blurry thing (BB4W + GfxLib)
Fair point. Here's the source code:
http://www.proggies.uk/temp/blurry_src.zip
I had to tidy up the program a bit and make some modifications so that it actually worked (it relied on a library file that was no longer compatible), which is probably why I didn't include the source in the first place.
Re: Rotating blurry thing (BB4W + GfxLib)
You have to take full much credit for those nice smooth colour gradients on display with my version, because It relies on your excellent PlotRotateScaleBilinear routine to achieve the effect.RichardRussell wrote: ↑Fri 22 Nov 2019, 17:46 It took me no more than ten minutes to create this (admittedly poor in comparison with David's) BBCSDL version; it may be tricky to improve on it greatly given SDL's 8-bit alpha resolution.

Re: Rotating blurry thing (BB4W + GfxLib)
To enable bilinear filtering in the BBCSDL version modify the code as follows, it does reduce the 'pixellation':David Williams wrote: ↑Fri 22 Nov 2019, 23:37It relies on your excellent PlotRotateScaleBilinear routine to achieve the effect.![]()
Code: Select all
SYS "SDL_SetHint", "SDL_RENDER_SCALE_QUALITY", "linear"
tex%% = FNloadtexture(@dir$ + "BBCSDL_spectrum.png")
-
- Posts: 42
- Joined: Tue 22 May 2018, 13:51
Re: Rotating blurry thing (BB4W + GfxLib)
Gaudi probably thought the same thing when he built the Sagrada familiar without any plans. People talk about not reinventing the wheel in coding but this is more like reverse engineering. There are many compiled programs where the source code is lost or like Fermat last theorem when the apparent solution is also lost. The rosetta code is full of these reinventions.
Re: Rotating blurry thing (BB4W + GfxLib)
Click here to run this program in your browser (Chrome, Edge or Firefox)!RichardRussell wrote: ↑Fri 22 Nov 2019, 17:46isn't there perhaps just as much interest and challenge in reproducing something similar from scratch without having somebody else's source code to copy?