Advertisement
Brandan

Untitled

Mar 6th, 2014
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.58 KB | None | 0 0
  1.     Private Sub GlControl1_Paint(sender As Object, e As PaintEventArgs) Handles GlControl1.Paint
  2.         ' render graphics
  3.         GL.Clear(ClearBufferMask.ColorBufferBit Or ClearBufferMask.DepthBufferBit)
  4.  
  5.         'Basic Setup for viewing
  6.         Dim perspective As Matrix4 = Matrix4.CreatePerspectiveFieldOfView(1, 1, 1, 10000) 'Setup Perspective
  7.         Dim lookat As Matrix4 = Matrix4.LookAt(0, 0, 150, 0, 0, 0, 0, 1, 0) 'Setup camera
  8.         GL.MatrixMode(MatrixMode.Projection) 'Load Perspective
  9.         GL.LoadIdentity()
  10.         GL.LoadMatrix(perspective)
  11.         GL.MatrixMode(MatrixMode.Modelview) 'Load Camera
  12.         GL.LoadIdentity()
  13.         GL.LoadMatrix(lookat)
  14.         GL.Viewport(0, 0, GlControl1.Width, GlControl1.Height) 'Size of window
  15.         GL.Enable(EnableCap.DepthTest) 'Enable correct Z Drawings
  16.         GL.DepthFunc(DepthFunction.Less) 'Enable correct Z Drawings
  17.  
  18.         ' GL.Rotate(mousepos.X, 0, 1, 0)
  19.         ' GL.Rotate(mousepos.Y, 0, 0, 1)
  20.  
  21.         'Rotating
  22.         'GL.Rotate(100, 1, 0, 0)
  23.         'GL.Rotate(20, 0, 1, 0)
  24.         'GL.Rotate(173, 0, 0, 0)
  25.         GL.Translate(New Vector3(-64, -64, 0))
  26.  
  27.         GL.Begin(PrimitiveType.Points)
  28.  
  29.         For Each p In Map_Loaded
  30.  
  31.             If p.height > 5 Then
  32.                 GL.Color3(Color.FromArgb(0, 255 - p.height, 0))
  33.                 GL.Vertex3(p.x, p.y, p.height / 5)
  34.             Else
  35.                 GL.Color3(Color.FromArgb(0, 0, 100))
  36.                 GL.Vertex3(p.x, p.y, 0)
  37.             End If
  38.  
  39.         Next
  40.  
  41.  
  42.         GL.[End]()
  43.  
  44.         GlControl1.SwapBuffers()
  45.  
  46.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement