Class: GlStuff::GlUtility

Inherits:
Object
  • Object
show all
Defined in:
lib/examples/GlStuff/gl_utility.rb

Class Method Summary collapse

Class Method Details

.draw_line(ax, ay, bx, by, width, r, g, b, a) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/examples/GlStuff/gl_utility.rb', line 4

def self.draw_line(ax, ay, bx, by, width, r, g, b, a)
  glDisable(GL_TEXTURE_2D);
  #glEnable(GL_BLEND);
  #glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glColor4ub( r, g, b, a);

  glLineWidth(width);
  glBegin(GL_LINES);
  glVertex2i( ax, ay);
  glVertex2i( bx, by);
  glEnd();

  #glDisable(GL_BLEND);
  glEnable(GL_TEXTURE_2D);
end

.mem_pointer(array) ⇒ Object



21
22
23
# File 'lib/examples/GlStuff/gl_utility.rb', line 21

def self.mem_pointer(array)
  MemoryPointer.new(:float, array.size).put_array_of_float(0, array)
end