I am using Blender Game Engines Filter 2D to make a post effect with GLSL. In an fragment shader applied on the frame buffer, I want to access the size in pixels of that buffer in GLSL.
uniform vec2 screensize;
This is possible for objects of the type BL_Shader
shader.setUniform2f("screensize", w, h)
The viewport size can be accessed in this way
import bge
w = bge.render.getWindowWidth()
h = bge.render.getWindowHeight()
print (w,h)
But I don't know how to get the BL_Shader object. The SCA_2DFilterActuator does not have any reference to such object.
co = bge.logic.getCurrentController()
distortion = co.actuators["riftDistortion"]