Class: GLViewer::GL2DViewer
- Inherits:
-
Object
- Object
- GLViewer::GL2DViewer
- Defined in:
- lib/rglviewer/gl2dviewer.rb
Instance Attribute Summary collapse
-
#background ⇒ Object
Returns the value of attribute background.
-
#height ⇒ Object
Returns the value of attribute height.
-
#init ⇒ Object
Returns the value of attribute init.
-
#render ⇒ Object
Returns the value of attribute render.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ GL2DViewer
constructor
A new instance of GL2DViewer.
- #main_loop ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ GL2DViewer
Returns a new instance of GL2DViewer.
10 11 12 13 14 15 16 17 18 |
# File 'lib/rglviewer/gl2dviewer.rb', line 10 def initialize args = {} @width = args[:width] || 640 @height = args[:height] || 480 @background = args[:background] || [255,255,255] @init = args[:init] || Proc.new {} @render = args[:render] || Proc.new {} @width = 1 if @width <= 0 @height = 1 if @height <= 0 end |
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
8 9 10 |
# File 'lib/rglviewer/gl2dviewer.rb', line 8 def background @background end |
#height ⇒ Object
Returns the value of attribute height.
8 9 10 |
# File 'lib/rglviewer/gl2dviewer.rb', line 8 def height @height end |
#init ⇒ Object
Returns the value of attribute init.
8 9 10 |
# File 'lib/rglviewer/gl2dviewer.rb', line 8 def init @init end |
#render ⇒ Object
Returns the value of attribute render.
8 9 10 |
# File 'lib/rglviewer/gl2dviewer.rb', line 8 def render @render end |
#width ⇒ Object
Returns the value of attribute width.
8 9 10 |
# File 'lib/rglviewer/gl2dviewer.rb', line 8 def width @width end |
Instance Method Details
#main_loop ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rglviewer/gl2dviewer.rb', line 22 def main_loop glutInit glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA ) glutInitWindowSize(@width,@height) glutInitWindowPosition(0,0) @window = glutCreateWindow("RGLViewer") glutDisplayFunc(method(:gl_draw).to_proc) glutIdleFunc(method(:gl_idle).to_proc) glutReshapeFunc(method(:gl_reshape).to_proc) gl_init glutMainLoop end |