OpenGL screen filters?

Previous topic - Next topic

doimus

Would it be possible to implement the function of screen filters in GLB?
Kind of like it's done in almost any retro game emulato - filters that process the whole screen, making it look different, scaled 2x, with scanlines, etc...

Here's an example I googled out, to illustrate the usage of those filters. Pay attention how the Yoshi's island looks for example - it's amazing!
http://www.neogaf.com/forum/showthread.php?s=4269ccbc52dc1d8dc6b8a4dac401229f&t=221725

Here's another example of PAL filtering for the Amiga emulator. Really brings out the charm in retro graphics.
http://eab.abime.net/showthread.php?t=29206


D2O

Sorry, bad English  :puke:

Can help this?

Code (glbasic) Select
SETSCREEN 320,240,0

GETSCREENSIZE x,y
line = 2

DRAWRECT 0,0,x,y,RGB(0xff, 0x00, 0x80)

FOR i = 0 TO y/line-1 STEP line

DRAWRECT 0,line*i,800,line,RGB(0x11, 0x11, 0x11)
NEXT

SAVEBMP "scanline.png"
BLACKSCREEN

LOADSPRITE "scanline.png",0



WHILE TRUE

DRAWRECT 0,0,x,y,RGB(0xfc, 0x83, 0xb6)


ALPHAMODE -0.5
DRAWSPRITE 0,0,0
ALPHAMODE 0.0
SHOWSCREEN

WEND
END
I7 2600K; 8 GB RAM ; Win10 Pro x64 | NVidia GTX 750 TI 2048MB ; Realtec OnBoard Sound;
Lenovo ThinkPad T400: XP Pro
GLB Premium-immer Aktuell

doimus

#2
No, that's just a workaround if you need scanlines.

Filters offer much, much more, and the code is already available.
For example, you are developing on the PC, for Wiz which has 320x240 screen.
If you use windowed mode on the PC, everything is too small on screen. If you use fullscreen then everything is just too big and pixelated.

If we had filters, you could possibly enable "2x filter" that would scale everything on screen by two, thus having 640x480 window, without hacks in the code.

for example, the command would be something like this

GLFILTER type, value1, value2, etc...

so for HQ3x resize filter(like in above yoshi island example) it would be:
type = 1 (resize)
value1 = resize times (2x, 3x)
value2 = 0 -normal, 1 -high quality

Code (glbasic) Select

SETSCREEN 320, 240, 0

GLFILTER 1, 3, 1


That way you could easily manipulate multiple filters, or remove them easily.

doimus


Kitty Hello

Yes, possible.
Procedure:
Draw to your backbuffer and GRABSPRITE, or even to a SCREEN in the first place.
Load and apply a shader (X_LOADSHADER).
Draw the sprite with DRAWSPRITE.

I did this here:
http://www.glbasic.com/showroom.php?game=C64colorshader which is exacly what you want, but the other way round ( I make images look worse instead of better ;) )

This might be interesting for you:
http://wiki.github.com/pdjonov/hqnx