Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. attribute vec4 position;
  2. uniform mat4 supermatrix;
  3. void main()
  4. {
  5.     // the value at supermatrix[3][3] is a float that is incremented by .01 every draw call
  6.     float Q = sin(supermatrix[3][3]);
  7.     /*
  8.                 I want to scale the vertices of a rectangle that occupies the
  9.         top right quadrant of the screen ((0,0) -> (1,1)) vertically
  10.         by whatever the value of Q is, so I multiply the vertices by
  11.         a scaling matrix which should scale the vertices' y values by Q.
  12.  
  13.                 As rendering progresses, the the vertices should be scaled
  14.         by -1x to 1x in a sinusoidal shape.
  15.                        
  16.                 But it doesn't. As soon as Q is negative, the rectangle no longer renders.
  17.         */
  18.     gl_Position = position*mat4(vec4(1.0,0.0,0.0,0.0),
  19.                     vec4(0.0, Q ,0.0,0.0),
  20.                     vec4(0.0,0.0, Q ,0.0),
  21.                     vec4(0.0,0.0,0.0,1.0));
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement