subengari

Villager
Member
Joined
Dec 12, 2020
Messages
22
Reaction score
8
First Language
king's english
Primarily Uses
RMMV
Kamusta dudes and dudettes,

I'm taking a look at the ColorFilter class and came across ColorFilter.prototype._fragmentSrc (which contains the GLSL code for the filter):
ColorFilter_fragmentSrc.png

Looking at other GLSL code on the interwebs, I noticed that the code below contains "#" before certain statements...
glsl_example.png

Can anybody explain the difference between the two... why is "#" used in one and not the other? And if I were to use GLSL code similar to the latter in my own RMMZ filter, would I still include the "#"?

Thanks in advance!
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,862
Reaction score
2,198
First Language
EN
Primarily Uses
RMMZ
#ifdef and its accompanying #else are C-like preprocessor directives, i.e. instructions for the compiler. This MSDN article explains the use of such directives in C:
Page 3 of these reference cards has a brief summary of available directives for WebGL:
In the example you cited, I think (?) it is checking whether this shader program has already encountered a #define SIMPLE_LINEAR_GAMMA directive: if so, it compiles one shader; if not, it compiles the other one instead.

Note that MV/MZ games use WebGL, a.k.a. OpenGL ES ("Embedded Systems"). This is limited in various ways compared to standard OpenGL, e.g. you can only access vertex and fragment shaders. Here are some technical links for further information:
And a couple more for tutorials/examples:
:kaohi:
 

subengari

Villager
Member
Joined
Dec 12, 2020
Messages
22
Reaction score
8
First Language
king's english
Primarily Uses
RMMV
@caethyril thank you for the clarification and the supporting documents! I have some reading to do after breakfast :)
 

Latest Threads

Latest Posts

Latest Profile Posts

Haven't been on here actively in awhile, project is going strong my biggest issue is the STORY, i'm refining the plot and learning so much i decided to take a writers class to improve even more but the programming and functionality of the game is stepping up nicely!
Hi everyone! Here's what I'm working on today! It's one of the dorms on campus. I know I said I wouldn't use assets but I reused a few things from the cafeteria hehe.
FCuxBOMXMAICK5e
I added a little squish effect when characters change direction to try and make things a bit more lively. Though it's a bit hard to see on the fast moving guys.
2f4fiuy.gif
I just discovered this game exists; the premise itself is ****ing hilarious. https://www.humblebundle.com/store/kill-it-with-fire
Can't wait for next update! :)

Forum statistics

Threads
116,120
Messages
1,095,940
Members
151,526
Latest member
Caraba19
Top