SHARE
TWEET

Untitled

a guest Jun 25th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Requirements: Cython, glumpy
  2.  
  3. from glumpy import app, gloo, gl
  4.  
  5. window = app.Window()
  6.  
  7. vertex = """
  8.   attribute vec2 position;
  9.   void main()
  10.   {
  11.       gl_Position = vec4(position, 0.0, 1.0);
  12.   } """
  13.  
  14. fragment = """
  15.   uniform vec4 color;
  16.   void main() {
  17.       gl_FragColor = color;
  18.   } """
  19.  
  20. quad = gloo.Program(vertex, fragment, count=4)
  21.    
  22. quad['position'] = [(-0.5, -0.5),
  23.                     (-0.5, +0.5),
  24.                     (+0.5, -0.5),
  25.                     (+0.5, +0.5)]
  26.  
  27. quad['color'] = 1,0,0,1  # red
  28.  
  29. @window.event
  30. def on_draw(dt):
  31.     window.clear()
  32.     quad.draw(gl.GL_TRIANGLE_STRIP)
  33.    
  34. app.run()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top