class Fox::FXGLPoint

OpenGL point object

Attributes

pos[RW]

Point position, in model coordinates (a 3-element array)

Public Class Methods

new(*args) click to toggle source

Returns an initialized FXGLPoint instance. If no arguments are passed to new, the initial point position is (0.0, 0.0, 0.0). You can specify a different initial position by passing in the x, y and z coordinates individually:

aPoint = FXGLPoint.new(x, y, z)

or as a 3-element array:

aPoint = FXGLPoint.new([x, y, z])
Calls superclass method Fox::FXGLObject.new
# File lib/fox16/glshapes.rb, line 28
def initialize(*args)
  super()
  if args.length == 0
    @pos = [0.0, 0.0, 0.0]
  elsif args.length == 3
    @pos = [args[0], args[1], args[2]]
  else
    @pos = args[0]
  end
end

Public Instance Methods

bounds() click to toggle source

Return the bounding box (an FXRangef instance) for this point.

# File lib/fox16/glshapes.rb, line 42
def bounds
  FXRangef.new(@pos[0], @pos[0], @pos[1], @pos[1], @pos[2], @pos[2])
end
draw(viewer) click to toggle source

Draw this point into viewer (an FXGLViewer instance).

# File lib/fox16/glshapes.rb, line 49
def draw(viewer)
  GL::Color(0.0, 0.0, 1.0)
  GL::PointSize(HANDLE_SIZE)
  GL::Begin(GL::POINTS)
  GL::Vertex(@pos)
  GL::End()
end
hit(viewer) click to toggle source

Perform hit test for this point in viewer (an FXGLViewer instance).

# File lib/fox16/glshapes.rb, line 60
def hit(viewer)
  GL::Begin(GL::POINTS)
  GL::Vertex(@pos)
  GL::End()
end