| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Dokkio Sidebar (from the makers of PBworks) is a Chrome extension that eliminates the need for endless browser tabs. You can search all your online stuff without any extra effort. And Sidebar was #1 on Product Hunt! Check out what people are saying by clicking here.

View
 

Rainbow Colourmap

Page history last edited by matthew 2 years, 7 months ago

 

  1. dim screenWidth = WindowWidth()
  2. dim screenHeight = WindowHeight()
  3.  
  4. glMatrixMode(GL_PROJECTION)
  5. glLoadIdentity ()
  6. glOrtho(0, screenWidth, screenHeight, 0, 0, 1)
  7. glDisable(GL_DEPTH_TEST)
  8. glMatrixMode(GL_MODELVIEW)
  9. glLoadidentity()
  10. glTranslatef(0.375, 0.375, 0)
  11. glDrawBuffer(GL_FRONT_AND_BACK)
  12. glClearColor(0.0, 0.0, 0.0, 0.0)
  13. glClear(GL_COLOR_BUFFER_BIT)
  14.  
  15. const frequency# = 0.3
  16.  
  17. dim red, green, blue, i, x, y
  18.  
  19. for x = 0 to screenWidth step 25
  20.  
  21.     red   = sin(frequency# * i + 0) * 127 + 128
  22.     green = sin(frequency# * i + 2) * 127 + 128
  23.     blue  = sin(frequency# * i + 4) * 127 + 128
  24.  
  25.  
  26.     glBegin(GL_QUADS)
  27.     glColor3ub(red, green, blue)
  28.     glVertex2f(x, 0)
  29.     glVertex2f(x+25, 0)
  30.     glvertex2f(x+25, screenHeight)
  31.     glVertex2f(x, screenHeight)
  32.     glEnd()
  33.  
  34.     SwapBuffers()
  35.  
  36.     i = i + 1
  37.  
  38. next
  39.  
  40. beep()

 

 

Comments (0)

You don't have permission to comment on this page.