HISE Logo Forum
    • Categories
    • Register
    • Login

    Glsl shader doesn't work when exported

    Scheduled Pinned Locked Moved General Questions
    14 Posts 4 Posters 416 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.
    • elemen8tE
      elemen8t
      last edited by elemen8t

      Hey there,

      my glsl animation works great in HISE, but not when exported.

      I saw an earlier post from @Christoph-Hart about that, but couldn't make it work.

      I set the OPEN_GL="1" in the xml settings before exporting and put the .glsl file into the scripts folder.

      Sadly the "using File -> Copy embedded files to project folder" isn't avalable anymore so there might be something I am missing.

      HiseSnippet 4281.3oc66rsbajakj1lo7nLo1jT6G.Jmp1poEIMuHZKuxZxn61qks0Z4wy3jZqo.YilDiZhloaz5Vh+Sxi9aXeZ1mzOz9v99tmC.5tAZ1T1imcRlZxnGj5F.mCN3b+bPK14Rlvm4+0IB974LYsZ0u4QwQiYIIQw0puxqtXNqV8OswwWHjS2YJkKp8jcqU+W130r3Ddjfzq11WLmljv7qUu9MO.WP8O4V0T+7e+62lFREiYECUq1qi3iYGxmwkEidzm+TdX39Te1q3yrV8Ze9SFGI1IJLJEHla1nas4zwmPmvdNEW1MZT6wzjo0pe2Fiocuev3QOLnKq+CB7G8fQr0FxdnO6g2e8wCCVe35C5yFr98qU+WrmOWFEerjJYI0peqsi7u33oQmIzavq4I7QgL7kd0NF1Y8v6GE5iGQbzZ6LkG5mykR.d1sr3Y2Tyy9ma7LtOOe7Bd2uVMAo.BaFX8a3Rd2zg75YSdcsHuJHo5Vjzszjzuowwii4ykEynkkOQHYwATPNYSJ50V6F+Wqz3d2i73mb7dj+M5oT8vjKSiIOMjO9j1flPPT3jTwDRvUeaLwmIHGOEjkwqrSDfYgryL5Ir8igWx2Iugc61hL7A8atwJfHNQRNkFSRlR1jjAz3XFvCzXx6NiREhK5LILI7NNf7hT47TIp2AfpzR6LgI2KHfMV5cG8rHDq.mginBVHIU3anu16wE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dDyGOXntekMH0zZTSSQkkNEJDVkaJLEjEmn0h66cK4LnzF71UbexsQTV8TC07K6O3mU8uFMyrPusVBA+8W2e46vOwT9WH9at1u6LUp9WRo86j9edWfQse2XY+rt+0nYpyerEo+OPZ9KC++DSuuTJk4Z81iWoNuip52IM9hqt.U4WH8qeVq+ZzJyK+oEYvOPJ9WyV7SLc+EqUJW8uzTUZATVy86jQvSilMhKTLNraN3GsfozfhxJwVf5zpmRs0YejRUcG.6Qry0zmdZmKZY06Gqm6i8Gbw751nTmWduH2pwN1uTfd2.ma3zTkqG6m2pnoMEOVfYamSaTtcIuWTa2LFm2J1fRh+MVlnihkNqkeEjQfMAjqDTRfsZwLkY2VS4xorln7Q0kBs5qo9RHTjXKR5L821.15VIW8e+2ko3+kQyXbemq0CLDx+tlM1E41FpMrSbKqCZmIMcdcjwV.cv6fpOS+kOX4Zu33cuMc11pt05haVALO1Jb9TZ6h+WFLsREGUeCR5dXUQsMqVYNeqVQDwUqTeXosu+.VBclbgtqacHU84dXVet0s7E6wc+EtphIzQrhKiTcpdTEgFUslVqqAZeqk0pBqeou5zWGEFhTkvmOgHK92mw4KKX4ns3HzRyhy+pBdashuxLA678ANA9IT9+gh62Rb
      
      A 1 Reply Last reply Reply Quote 0
      • A
        aaronventure @elemen8t
        last edited by

        @elemen8t go to the app data folder of the plugin ad set open gl to 1 in the general settings.

        Or is that something you already did?

        You also need to call Settings.enableOpenGl and set it to true in the script, and then restart your plugin.

        elemen8tE clevername27C 2 Replies Last reply Reply Quote 1
        • elemen8tE
          elemen8t @aaronventure
          last edited by

          @aaronventure Awesome yes, I did the first one but not script one, now it works thank you very much!

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

            @elemen8t you can implement the script one as a switch so that the user can disable it if they run I to issues. There's a history of reports with headless systems like VEP where the GPU is never engaged because there's no display connected, so the plugin renders as a black background on the network clients.

            VEP in particular may have resolved that since then, but I have not checked nor would bet on it, so it's a good idea to have a switch that let's the user disable it, and then pop out a reminder that they should restart the plugin.

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

              @aaronventure Ah alright yes good advice, I also thought about a enable/disable animation toggle so the user won't have any performance issues if the animations are to heavy on the GPU.

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

                @aaronventure said in Glsl shader doesn't work when exported:

                Settings.enableOpenGl

                First, thank you for the tip. Second—does it seem strange to you that we check the OpenGL button in the project settings—and OpenGL works in HISE—but then doesn't work in the exported plugin? And then…there is an OpenGL flag in HISE's compile settings—but that setting doesn't work. Because there's a second, secret setting in the App Data folder.

                Am I only the person who thinks this is insanity?!

                A HISEnbergH 2 Replies Last reply Reply Quote 0
                • A
                  aaronventure @clevername27
                  last edited by

                  @clevername27 Hah wait till you find out that it doesn't work at all if there's no flag in GeneralSettings xml and that sometimes won't get created by HISE itself (testing on the latest commit).

                  HISEnbergH 1 Reply Last reply Reply Quote 0
                  • 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

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

                                48

                                Online

                                1.7k

                                Users

                                11.7k

                                Topics

                                101.8k

                                Posts