Import gears_using_shaders into git
[gears_using_shaders.git] / readme.txt
blob87a629e76f8abfa5bbca59beca71130e8ae99418
1 Created 2009-Mar-08 by Michael Brooks:\r
2 \r
3 \r
4 --- Description ---\r
5 \r
6 This Ruby program uses OpenGL, Glut and GLSL shaders to displays 3 different\r
7 colored mechanical gears rotating at about 90 degrees per second.  The program\r
8 is based heavily on the Ruby "gears.rb" program created by Arto Bendiken in May,\r
9 2005.  The program differs from the original program in the following ways:\r
11 - Renamed the original procedures and added comments to, hopefully, \r
12   add clarity to the code.\r
13 - Reorganized some of the original code around to, hopefully, \r
14   add clarity to the code.\r
15 - Changed the flat lit red, green and blue gears to two velvet (green and blue) \r
16   gears and one shiny (red) gear using a combination of standard OpenGL material \r
17   definitions and two GLSL shaders.\r
18 - Disabled (i.e. didn't enable) standard OpenGL lighting and smoothing because \r
19   the shaders take care of that.\r
21 The example has been testing with Ruby 1.8.6 on an Intel Pentium P4 3Ghz \r
22 equipped with an overclocked AGP ATI Radeon 3850 with Windows XP and running \r
23 at about 1850 fps.  It performs at the same speed as the original gears.rb\r
24 program but displays more complex materials.  I haven't yet successfully \r
25 installed ruby-opengl in Ruby 1.9.1 on my PC but see no reason why this \r
26 program couldn't run on Ruby 1.9.1.\r
28 On a side note, if you change the program to use only one of the two shaders \r
29 it will run at about 2150 fps, which demonstrates the penalty for "state changes"\r
30 in OpenGL (the same kind of thing can happen in Direct3D too).\r
32 Please note, this program is not meant to teach GLSL shaders... that is a much \r
33 more complex topic.  It is meant to help folks get a leg up on implementing more\r
34 advanced OpenGL features via Ruby.  Also, please remember that this program,\r
35 more importantly the attached shaders examples, only support one light.  So \r
36 don't be surprised if you add an OpenGL light and things don't look the way \r
37 you expect.\r
39 I hope this code helps you.  Have fun!\r
42 Michael\r
45 --- Install and execution ---\r
47 1) Install Ruby (http://www.ruby-lang.org/en/, only tested with 1.8.6), \r
48            GLUT (http://www.opengl.org/resources/libraries/glut/), \r
49            Ruby-OpenGL (http://ruby-opengl.rubyforge.org/) and \r
50            OpenGL 2.0 or greater (refer to your video card vendor).\r
51 2) Extract the ZIP files to a directory of your choice.\r
52 3) Within that directory at the command line type "ruby gears_using_shaders.rb"\r