def realize(w)
glcontext = w.gl_context
gldrawable = w.gl_drawable
light_diffuse = [1.0, 0.0, 0.0, 1.0]
light_position = [1.0, 1.0, 1.0, 0.0]
gldrawable.gl_begin(glcontext) do
$font_list_base = GL.GenLists(128)
font_desc = Pango::FontDescription.new FONT_STRING
font = Gdk::GL.use_pango_font(font_desc, 0, 128, $font_list_base)
if !font
puts "*** Can't load font '#{FONT_STRING}'\n"
exit 1
end
font_metrics = font.metrics
$font_height = font_metrics.ascent + font_metrics.descent
$font_height = Pango.pixels($font_height)
GL.ClearColor(1.0, 1.0, 1.0, 1.0)
GL.ClearDepth(1.0)
GL.Viewport(0, 0, w.allocation.width, w.allocation.height)
GL.MatrixMode(GL::PROJECTION)
GL.LoadIdentity
GL.Ortho(0.0, w.allocation.width,
0.0, w.allocation.height,
-1.0, 1.0);
GL.MatrixMode(GL::MODELVIEW)
GL.LoadIdentity
end
end