GLSL shaders - predefined macros etc

  • Hello

    I have a shader which was originally written for ISF and then converted to GLSL using Mark's clever script and this works great.

    To avoid having two versions I am aiming to get both to share the code with a few #ifdefs sprinkled in to allow me to filter out the bits of code which only work on one platform or the other.

    Are there any pre-defined macros or similar which isadora exposes to the shader that I can check for the existance of to allow me to get this to work? According to I think I should be able to check for the existance of GL_core_profile but this doesn't seem to ever return true



  • Beta Platinum


    GL_core_profile according to the page is always set to 1 (true), so your findings are correct. Could you give an example of why the Shader would not work on different platforms (Mac / PC). If so we might be able to come up with a solution.

  • Hi @juriaan 

    My issue is that I have a shader which I sometimes use in Isadora (with GLSL) and sometimes in Millumin (ISF) - there are a couple of minor differences between how the two shaders need to be written and so - to make it easier to maintain and update - ideally I would add in some #ifdefs to separate out the lines for each implementation.

    My current attempt can be seen at - if you add in an #define GL_ES at the top then it runs fine in isadora, however I can't find a macro that will evalulate to true to put here. (GL_core_profile doesn't appear to)

    My main issue is that the ISF shader creates the variables itself through the json blob, so I can't re-declare them, whereas isadora needs them decalaring globally so it can populate them.

    If isadora could pass a defined macro in to the script that I can evaluate that would be the ideal, but any other thoughts would be appreciated!