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

Advanced game related topics
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 772
Joined: Fri Dec 04, 2015 9:26 pm

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

Post 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.
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

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

Post 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
Nituvious
Addict
Addict
Posts: 1027
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

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

Post 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.
▓▓▓▓▓▒▒▒▒▒░░░░░
Post Reply