OSU CS 519 - Flat Interpolation in the Rasterizer

Unformatted text preview:

1mjb – May 4, 2007Flat Interpolation in the RasterizerMike BaileyOregon State Universitymjb – May 4, 2007Declaring a Varying Variable to be Flat#version 120flat varying float LightIntensity;const vec3 LightPos = vec3( 0., 10., 0. );void main( ){vec3 tnorm = normalize( gl_NormalMatrix * gl_Normal );vec3 ECposition = ( gl_ModelViewMatrix * gl_Vertex ).xyz;LightIntensity = dot( normalize(LightPos - ECposition), tnorm );LightIntensity = abs(LightIntensity );LightIntensity *= 1.5;gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;}#version 120flat varying float LightIntensity;uniform vec4 Color;voidmain( ){gl_FragColor = vec4( LightIntensity * Color.rgb, 1. );}flat.vertflat.frag2mjb – May 4, 2007Declaring a Varying Variable to be Flatvarying float LightIntensity;flat varying float LightIntensity;mjb – May 4, 2007Declaring a Varying Variable to be Flatvarying float LightIntensity;flat varying float


View Full Document

OSU CS 519 - Flat Interpolation in the Rasterizer

Download Flat Interpolation in the Rasterizer
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Flat Interpolation in the Rasterizer and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Flat Interpolation in the Rasterizer 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?