VFragCoord

Fragment shader pixel coordinates VGen.
See also: VNormPos VTexPos VTextureSize Scintillator Default Graphics Setup

Description


FragCoord exposes the underlying GLSL primitive gl_FragCoord. It returns the position of the running fragment shader in pixel dimensions, with the origin in the upper left hand corner of the screen. Note that the FragCoord returns screen-relative coordinates, not geometry coordinates.

Class Methods


VFragCoord.pr

dimensions

input

output

none

2

Examples


(
~v = ScinServer.new.boot;
)

// Note this ScinthDef uses the ScinServerOptions object defined above
// in the ScinServer to provide screen width and height as constants to the Scinth.
(
~f = ScinthDef.new(\f, {
    VRGBOut.pr(
        VX.pr(VFragCoord.pr) / ~v.options.width,
        0.0,
        VY.pr(VFragCoord.pr) / ~v.options.height);
}).add;
)

(
~t = Scinth.new(\f);
)