This page was last updated: January 14, 2024
##OpenGL GLIB Ortho -1. 1. -1. 1. LookAt 0. 0. 2. 0. 0. 0. 0. 1. 0. Texture2D 5 DogC.bmp Texture2D 6 DogD.bmp Vertex whirlfisheye.vert Fragment whirlfisheye.frag Program WhirlFisheye \ TexUnitA 5 \ TexUnitB 6 \ uPower <1. 1. 10.> \ uRtheta <0. 0. 50.> \ uMosaic <0.001 .001 .06> \ uBlend <0. 0. 1.> QuadXY 0.1 1.
#version 330 compatibility uniform float uPower; uniform float uRtheta; uniform float uMosaic; uniform float uBlend; uniform sampler2D TexUnitA; uniform sampler2D TexUnitB; in vec2 vST; const vec4 BLACK = vec4( 0., 0., 0., 1. ); float atan2( float y, float x ) { if( x == 0. ) { if( y >= 0. ) return PI/2.; else return -PI/2.; } return atan(y,x); }
vec2 st = vST - vec2(0.5,0.5); // put (0,0) in the middle so that the range is -0.5 to +0.5 float r = the length of st float r' = (2r)uPower;
float θ = atan2( t, s ); float θ' = θ - uRtheta * r;
st = r' * vec2( cosθ',sinθ' ); // now in the range -1. to +1. st += ?; // change the range to 0. to +2. st *= ?; // change the range to 0. to +1.
// which block of pixels will this pixel be in? int numins = ??? // same as with the ellipses int numint = ??? // same as with the ellipses float sc = ??? // same as with the ellipses float tc = ??? // same as with the ellipses // for this block of pixels, we are only going to sample the texture at the center: st.s = sc; st.t = tc;
// if s or t end up outside the range [0.,1.], paint the pixel black: if( any( lessThan(st, vec2(?, ?)) ) ) // if s or t is < 0. { gl_FragColor = BLACK; } else { if( any( greaterThan(st, vec2(, ?)) ) ) // if s or t is > 1. { gl_FragColor = BLACK; } else { // sample both textures at (s,t) giving back two rgb vec3's: // mix the two rgb's using uBlend vec3 rgb1 = texture( ??, ?? ).rgb; vec3 rgb1 = texture( ??, ?? ).rgb; vec3 rgb = ????? gl_FragColor = vec4( rgb, 1. ); } }
Be sure that your PDF file is turned-in separately (not part of a .zip file).
Fisheye | Whirl | Mosaic | Blend |
Feature | Points |
---|---|
Fisheye works | 25 |
Whirl works | 25 |
Mosaic works | 25 |
Blending works | 25 |
Potential Total | 100 |