CapsAdmin

Untitled

Mar 25th, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. glfw.OpenWindow( 512, 512, 0, 0, 0, 0, 0, 0, GLFW_WINDOW )
  2. glfw.SetWindowTitle("me#2")
  3.  
  4. hook.Add("OnUpdate", "gl", function()
  5.     local width, height = glfw.GetWindowSize()
  6.  
  7.     gl.Viewport( 0, 0, width, height )
  8.  
  9.     gl.ClearColor( 0, 0, 0, 0 )
  10.     gl.Clear( GL_COLOR_BUFFER_BIT )
  11.  
  12.     gl.MatrixMode( GL_PROJECTION )
  13.     gl.LoadIdentity()
  14.     glu.Perspective( 65, width/height, 1, 100 )
  15.  
  16.     -- Draw some rotating garbage
  17.     gl.MatrixMode( GL_MODELVIEW )
  18.     gl.LoadIdentity()
  19.     glu.LookAt(0, -10, 0,
  20.             0, 0, 0,
  21.             0, 0, 1 )
  22.  
  23.     gl.Rotatef(os.clock()*50, 0.25, 1, 0.75)
  24.     gl.Begin( GL_TRIANGLES )
  25.       gl.Color3f(0.1, 0, 0 )
  26.       gl.Vertex3f(0, 3, -4)
  27.       gl.Color3f(0, 1, 0 )
  28.       gl.Vertex3f(3, -2, -4)
  29.       gl.Color3f(0, 0, 1 )
  30.       gl.Vertex3f(-3, -2, -4)
  31.     gl.End()
  32.     gl.Begin( GL_TRIANGLES )
  33.       gl.Color3f(0, 0.1, 0 )
  34.       gl.Vertex3f(0, 3, -3)
  35.       gl.Color3f(0, 0, 1 )
  36.       gl.Vertex3f(3, -2, -2)
  37.       gl.Color3f(1, 0, 0)
  38.       gl.Vertex3f(-3, -2, 2)
  39.     gl.End()
  40.     glfw.SwapBuffers()
  41. end)
Advertisement
Add Comment
Please, Sign In to add comment