Shader working on Mac but only showing on a quarter of the window on Windows

    Misc

    T. Mulard's icon
    T. Mulard's icon
    T. Mulard
    Jan 31 2023 | 2:32 pm
    Hello everyone, As a beginner in Max, I wanted to experiment on different things, and this time it was with shaders. Following some videos of 'Amazing Max Stuff'( https://www.youtube.com/@AmazingMaxStuff ), I tried implementing a patcher from ShaderToy (haven't found the link yet) and it worked flawlessly on Mac (version 10.14). But on Windows (10), when the shader runs, only the top right quarter of the window displays it, leaving the rest of it black, and even if I change the window size the problem remains. I tried searched online and found no answer yet, can you help ? Theo
    shadertest.maxpat
    maxpat 5.66 KB

    • Rob Ramirez's icon
      Rob Ramirez's icon
      Rob Ramirez
      Jan 31 2023 | 3:30 pm
      I think that rather than passing in the VIEWPORT state for iResolution, you should pass in the dimensions of the texture (TEXDIM0). so change state="VIEWPORT" to state="TEXDIM0" in your JXS header.
      The reason for this is that with high-dpi rendering, the viewport dimensions may be half (or some other multiple) of the texture dimensions, so best to pass the actual tex dims for those calculations. Confusing I know but that should fix things up.
      Share
    • T. Mulard's icon
      T. Mulard's icon
      T. Mulard
      Feb 01 2023 | 4:20 pm
      Sorry for the delay, but I tried adding your changes to the state and now even the quarter that used to display the shader is just a white square. Thanks anyway for the advice. Edit: My bad, the white square was due to a typo in TEXTDIM0. I tried afterwards with the correction but still it only shows a quarter of the shader
    • Rob Ramirez's icon
      Rob Ramirez's icon
      Rob Ramirez
      Feb 03 2023 | 10:37 pm
      hmm, one thing to make sure of is that you are using your machine's dedicated GPU rather than in integrated one (assuming you are on a laptop that has both), as described here