• Products
    • Isadora
    • Get It
    • ADD-ONS
    • IzzyCast
    • Get It
  • Forum
  • Help
  • Werkstatt
  • Newsletter
  • Impressum
  • Dsgvo
  • Press
  • Isadora
  • Get It
  • ADD-ONS
  • IzzyCast
  • Get It
  • Press
  • Dsgvo
  • Impressum

Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags

    GLSL shaders - predefined macros etc

    How To... ?
    3
    5
    1153
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      shadlx Beta Silver last edited by

      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 https://www.khronos.org/opengl... I think I should be able to check for the existance of GL_core_profile but this doesn't seem to ever return true

      Thanks!

      Richard

      Juriaan 1 Reply Last reply Reply Quote 0
      • Juriaan
        Juriaan Tech Staff @shadlx last edited by

        @shadlx

        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.

        Isadora 3.1.1, Dell XPS 17 9710, Windows 10
        Interactive Performance Designer, Freelance Artist, Scenographer, Lighting Designer, TroikaTronix Community moderator
        Always in for chatting about interaction in space / performance design. Drop me an email at hello@juriaan.me

        S 1 Reply Last reply Reply Quote 0
        • S
          shadlx Beta Silver @Juriaan last edited by

          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 https://github.com/LiminalET/Z... - 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!

          1 Reply Last reply Reply Quote 1
          • S
            shadlx Beta Silver last edited by

            Hello

            Just wondering if there are any other thoughts on this - I'm eager to try and consolidate the shader into one bit of code so any thoughts appreciated..

            Thanks!

            mark 1 Reply Last reply Reply Quote 0
            • mark
              mark @shadlx last edited by mark

              @shadlx said:

              Just wondering if there are any other thoughts on this - I'm eager to try and consolidate the shader into one bit of code so any thoughts appreciated..

              The issue with adding a predefined macro is that you'll need to wait for another version of Isadora. 

              The Shader Language version (i.e.,  __VERSION)__) on Isadora currently is 110; I suspect the version in other apps is probably higher. Try something like this:

              #if __VERSION__ > 110
               // execute non-isadora code here
              #else
              // execute isadora code here
              #endif

              Does that work?

              Best Wishes,
              Mark

              Media Artist & Creator of Isadora
              Macintosh SE-30, 32 Mb RAM, MacOS 7.6, Dual Floppy Drives

              1 Reply Last reply Reply Quote 0
              • First post
                Last post