Page 1 of 1

Does anyone have examples for learning purposes on importing 2d sprite and applying glsl shader to it?

Posted: Mon Dec 30, 2024 10:14 pm
by skinkairewalker
Could someone with shader experience give some examples of importing a sprite into purebasic and applying glsl shaders to it?
I would like to understand a little more about how shaders work on sprites or 2D images.

Re: Does anyone have examples for learning purposes on importing 2d sprite and applying glsl shader to it?

Posted: Tue Dec 31, 2024 10:31 am
by pf shadoko
viewtopic.php?t=84206&hilit=shader+sprite

there are several shader
go to the corresponding example
the export button (in the editor) saves your shader in the clipboard

don "t know if this has been tested on mac

Re: Does anyone have examples for learning purposes on importing 2d sprite and applying glsl shader to it?

Posted: Fri Jan 03, 2025 8:09 pm
by Nituvious
There's more to it than this but the gist is:
Change your shader program before drawing your sprite :mrgreen:
I think most people don't do it this way and just depend on attributes to change the state of a mega-shader but both ways will involve CPU to GPU uploads so if you're looking for speed to may want to benchmark it.