![Laughing :lol:](./images/smilies/icon_lol.gif)
I'm trying to retrieve the screen resolution inside a shader, and right now, I found no other way but to create in a ZExpression
ScreenSize : Array <mat4>
Then store the information inside it:
ScreenSize[0][0,0] = App.ScreenWidth;
ScreenSize[0][0,1] = App.ScreenHeight;
Then having a shaderVariable in my shader:
screenSize (ValueArrayRef:ScreenSize, ArrayKind:Mat4)
And use it in the shader:
float ditherScale = min(screenSize[0][0], screenSize[0][1]) / 640.0;
While it works, this seems overly complicated. Is there some other way to do that?
And as I'm writing it, I think it would be best to calculate the ditherScale during initialization, then pass that float to the shader.