class Fox::FXGLCylinder
OpenGL cylinder object
Constants
- LOOPS
- SLICES_NUMBER
-
Cylinder fidelity
- STACKS_NUMBER
Attributes
Cylinder height [Float]
Number of loops (default is 4) [Integer]
Cylinder radius [Float]
Number of slices (default is 20) [Integer]
Number of stacks (default is 20) [Integer]
Public Class Methods
Source
# File lib/fox16/glshapes.rb, line 363 def initialize(*args) if args.length == 5 super(args[0], args[1], args[2], SHADING_SMOOTH|STYLE_SURFACE) else super(args[0], args[1], args[2], SHADING_SMOOTH|STYLE_SURFACE, args[5], args[5]) end @height = args[3] ? args[3] : 1.0 @radius = args[4] ? args[4] : 1.0 @slices = SLICES_NUMBER @stacks = STACKS_NUMBER @loops = LOOPS setRange(FXRangef.new(-@radius, @radius, 0, @height, -@radius, @radius)) end
Returns an initialized FXGLCylinder instance.
One option is to initialize the cylinder with a specified origin, height and radius:
aCylinder = FXGLCylinder.new(x, y, z, h, r)
If left unspecified, the height (h) and radius (r) default to 1.0.
Another option is to initialize the cylinder with a specified origin, height, radius and material:
aCylinder = FXGLCylinder.new(x, y, z, h, r, material)
where the material is an FXMaterial instance.
Calls superclass method
Fox::FXGLShape::new
Public Instance Methods
Source
# File lib/fox16/glshapes.rb, line 381 def drawshape(viewer) quad = GLU.NewQuadric() GLU.QuadricDrawStyle(quad, GLU::FILL) GL.PushMatrix() GL.Rotated(-90, 1, 0, 0) GLU.Cylinder(quad, @radius, @radius, @height, @slices, @stacks) GLU.QuadricOrientation(quad, GLU::INSIDE) GLU.Disk(quad, 0, @radius, @slices, @loops) GL.Translated(0, 0, @height) GLU.QuadricOrientation(quad, GLU::OUTSIDE) GLU.Disk(quad, 0, @radius, @slices, @loops) GL.PopMatrix() GLU.DeleteQuadric(quad) end
Draw this cylinder into viewer (an FXGLViewer instance).