[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] How to set a canvas backing store to display units?
- gl_FragCoord.xy is in real pixel dimensions where +- 1 points to the next fragment, they start at viewport.left/right + 0.5 and end at viewport.left/right - viewport.width/height - 0.5
- gl.viewport defines the viewport
- the viewport definition is therefore in real pixels as they pertain to the back buffer size into which things are rendered
- the viewport is not used, was not used, and is never going to be used, to scale things, the "window" refers to the affine transform of shifting calculations for viewports that are not starting at 0,0 and the transform is defined as device normal space * viewport.width/height + viewport.left/right, this transform by definition does not include scaling device normal space to anything than real pixel screen space
This all being the case, you absolutely *cannot* do things that mean that viewport/gl_FragCoord are not in backing store dimensions, the entirety of rendering any kind of screen related logic (like postprocessing) depends on this being the case. I repeat, you cannot under any fricking circumstance make viewport/gl_FragCoord be anything else than real pixels.