HISE Logo Forum
    • Categories
    • Register
    • Login

    Glsl shader doesn't work when exported

    Scheduled Pinned Locked Moved General Questions
    17 Posts 6 Posters 530 Views
    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.
    • HISEnbergH
      HISEnberg @clevername27
      last edited by

      @clevername27 Yea I am super confused where to set this flag. It exists in Projucer, then in the HISE settings. There is the Custom Settings FloatingTile which allows you to dynamically set OpenGL, but this doesn't work, and there is the script callback as well. What is the proper procedure here, just use a script callback and communicate directly to the AppData folder?

      clevername27C 1 Reply Last reply Reply Quote 0
      • HISEnbergH
        HISEnberg @aaronventure
        last edited by

        @aaronventure Hmm also the plugin needs to be restarted according to the documentation, so it wouldn't be possible for a user to do this on their end:

        Link Preview Image
        HISE | Docs

        favicon

        (docs.hise.dev)

        1 Reply Last reply Reply Quote 0
        • clevername27C
          clevername27 @HISEnberg
          last edited by clevername27

          @HISEnberg Here's what to do (and again, thank you @aaronventure).

          1. Enable OpenGL In HISE. You don't need to do this before compiling HISE—just in your runtime HISE that you develop in.

          0e148c43-400c-4578-9b14-a788a2dcca00-image.png

          1. Early in your UI onInit(), do this: Settings.setEnableOpenGL(true);.

          2. Quit out of HISE.

          3. Go to the system folder for your plugin project (not for HISE). On macOS, this is in ~/Library/Application Support/your-plugin-name. It should look something like this:

          ff851047-dbb0-45d0-80ce-acd12b499ac7-image.png

          1. Open "GeneralSettings.xml" and set the OpenGl flag to true:

          a524e483-a01c-446c-a15a-bd612be78581-image.png

          1. Restart HISE.

          2. Profit.

          fantasia.mov


          There are occasions where OpenGL simply won't work, regardless of anything related to HISE. You may wish to give users an option to disable OpenGL. To do that:

          1. Implement a user preference system (such as the one I uploaded to the forum), allowing the user to decide about OpenGL. This way, when a user turns off OpenGL, it stays off.

          2. Before drawing the switch, check isOpenGLEnabled, and use the result to set the Component's value.

          3. Also, set the panel to display correctly.

          • If OpenGL should not be running, load a static image into your shader panel. And set Settings.setEnableOpenGL to false.
          • If it is running, then use the shader with that panel. And set Settings.setEnableOpenGL to true.
          1. When the user changes the OpenGL settings, tell users to close their DAW project, and open it again. This will allow your HISE plugin to reboot with the new OpenGL setting. (Don't tell users to remove and add your plugin again—this will annoy users, and more importantly, they would need to do this for every plugin instance.)

          Let me know if that sorts it for you.

          HISEnbergH 1 Reply Last reply Reply Quote 0
          • HISEnbergH
            HISEnberg @clevername27
            last edited by HISEnberg

            @clevername27

            Thanks, just a few things I noticed to get it working:

            1. Set the HISE_USE_OPENGL_FOR_PLUGIN=1 in the Extra Preprocessor Definitions of JUCE, rebuild HISE.
            2. Set the HISE_USE_OPENGL_FOR_PLUGIN=1 in the Project Settings of HISE.
            3. Set Settings.setEnableOpenGL(true) in the script and set Enable OpenGL in the Project Settings
            4. Then you can use the Custom Settings Floating Tile within the plugin dynamically to set OpenGL.

            This was my process though I wish I did opt for my own button/panel as I hate the custom settings LAF. Definitely some redundancy here but at least this works!

            elemen8tE 1 Reply Last reply Reply Quote 1
            • elemen8tE
              elemen8t @HISEnberg
              last edited by

              @HISEnberg

              Great discussion and help btw from you all.

              I have the issue that it works on my end and all my DAWs perfectly when exported, but not on other PCs which sseems like not a GLSL issue but more like a "stoored in plugin issue" I guess?

              @Christoph-Hart mentioned the "File -> Copy embedded files to project folder" method which is not avaiable in the current HISE version. I got the glsl script in my project folder in the Scripts folder but it seems that's not right?

              HISEnbergH 1 Reply Last reply Reply Quote 2
              • HISEnbergH
                HISEnberg @elemen8t
                last edited by

                @elemen8t Thanks for sharing.

                Perhaps you could leverage Settings.isOpenGLEnabled() to broadcast whether it is "enabled" or not:
                https://docs.hise.dev/scripting/scripting-api/settings/index.html#isopenglenabled

                I would like to hear @Christoph-Hart 's opinion on this as I wonder myself sometimes. What is the proper procedure for setting OpenGL up?

                I searched the docs for what's available but I don't see a clear way for enabling it and allowing users to enable/disable.

                Link Preview Image
                HISE | Docs

                favicon

                (docs.hise.dev)

                elemen8tE 1 Reply Last reply Reply Quote 0
                • elemen8tE
                  elemen8t @HISEnberg
                  last edited by

                  @HISEnberg

                  The thing is it is set everywhere to "enabled" and works great in my DAW which I think won't work if the glsl isn't enabled.

                  It is just that the shader isn't embedded in the plugin. I tried referencing the shader in the project folder but that glsl file is always empty when referenced.

                  
                  
                  const var glslPath = "{PROJECT_FOLDER}Images/bunny.glsl";
                  
                  
                  Console.print("Versuche GLSL-Shader zu laden: " + glslPath);
                  
                  
                  const var sh = Content.createShader(glslPath);
                  
                  
                  Console.print("Shader erstellt.");
                  
                  

                  I agree we really need an updated instruction on how to implement .glsl shaders correctly atm. @Christoph-Hart

                  sodanswishersS 1 Reply Last reply Reply Quote 1
                  • sodanswishersS
                    sodanswishers @elemen8t
                    last edited by

                    @elemen8t going through the same issue still haven't been able to figure it out did this get resolved yet ?

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      aaronventure @sodanswishers
                      last edited by

                      @sodanswishers I've been dabbing in an out if the GLSL part of HISE for well over a year now and definitive conclusion is this:

                      Use WebView and WebGL

                      Christoph HartC 1 Reply Last reply Reply Quote 1
                      • Christoph HartC
                        Christoph Hart @aaronventure
                        last edited by

                        The input parameter is the shader file name (without the .glsl extension and the file must be inside the Scripts folder of your project (it will be embedded like any other script file when you export the project).

                        Link Preview Image
                        HISE | Scripting | ScriptShader

                        A OpenGL shader object that can be rendered on a ScriptPanel

                        favicon

                        (docs.hise.dev)

                        // That's the image folder...
                        const var glslPath = "{PROJECT_FOLDER}Images/bunny.glsl";
                        
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        21

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        102.6k

                        Posts