Function: syncViewportUniforms()
ts
function syncViewportUniforms(uniforms, renderer): boolean;Experimental
Make viewport uniforms match what the renderer is actually drawing into. Primitives call this from onBeforeRender, so it runs for every draw with the GL viewport already set.
uViewport(device px) is always synced:gl_FragCoordis relative to it.- On the canvas,
uResolution/uPixelRatioare derived from it too. Without this, a primitive added to a scene without Primitive.setViewport kept the 1×1 default resolution, so every screen-space quad covered the whole canvas (spike B: seconds of GPU time per frame). - Render targets (picking, export) keep the logical size given via
setViewport, since their pixel ratio is not the renderer's.
Returns true when the CSS resolution or pixel ratio changed.
Parameters
| Parameter | Type |
|---|---|
uniforms | Pick<ViewportUniforms, "uResolution" | "uPixelRatio"> & object |
renderer | ViewportSource |
Returns
boolean