Welcome to Fractal Forums

Fractal Software => Fragmentarium => Topic started by: Sabine on November 05, 2016, 09:47:04 PM




Title: ProvidesInit
Post by: Sabine on November 05, 2016, 09:47:04 PM
No idea if I am in the right place here, and please bear with me as I really have no clue about GLSL programming  :embarrass:

At the moment I am having lots of fun trying to get colorpalette.frag working with different raytracers, for now in Knighties PseudoKleinianprogressiveDoF.frag. Got it going in DE-Raytracer (see attachment), and Almost in DE-Kn2cr11.frag (see attachment). In the latter I can #define almost anything except for ProvidesInit. As soon as I define that and build I get an "Could not link fragment shaders"-error. Can't find any info on that error online... No further errors except some warnings about "Implicit casts from float to vec2" from the Wang-Hash-thingy in DE-Kn2cr11.frag

The ProvidesInit sits in the 3D.frag and occurs multiple times
#ifdef providesInit
void init(); // forward declare
#else
void init() {}
#endif

So this - void init(); // forward declare -  is the reason for my problem... or rather, I am the reason for my problem, because I have no clue what this does (throw away all previous stuff/pass it to the next subroutine (yep, that's my level of programming experience... subroutines  rofl2))

Can someone be so kind and tell me what ProvidesInit does exactly? I presume some frags need it, but for what?


Title: Re: ProvidesInit
Post by: 3dickulus on November 06, 2016, 12:02:18 AM
#define ProvidesInit in your frag code and add...

void init() {

...some fabulous initialization code...

}

to initialize some step or variables as in this is the first call from main() to setup some things that are needed by your custom routines.

not really needed unless you write some code that explicitly requires this.


Title: Re: ProvidesInit
Post by: Sabine on November 06, 2016, 12:06:42 AM
Thanks a lot, Dick! :) I am especially grateful for that last line  :dink: