# \[SoC\] GlimR 0.1.0

**URL:** <https://www.ruby-forum.com/t/soc-glimr-0-1-0/98556>\
**Category:** Ruby\
**Created:** [July 16, 2006, 1:16am UTC](https://www.ruby-forum.com/t/soc-glimr-0-1-0/98556 "2006-07-16T01:16:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilmari\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a587f6/32.png) [@Ilmari\_H](https://www.ruby-forum.com/u/Ilmari_H)\
**Post date:** [July 16, 2006, 1:16am UTC](https://www.ruby-forum.com/t/soc-glimr-0-1-0/98556/1 "2006-07-16T01:16:31Z")

</div>

== GlimR 0.1.0 - Ruby OpenGL GUI Widget Kit ==

Homepage: [http://glimr.rubyforge.org/](http://glimr.rubyforge.org/)  
Download: [http://rubyforge.org/frs/?group\_id=1736](http://rubyforge.org/frs/?group_id=1736)  
Blog: [http://glimr.blogspot.com/](http://glimr.blogspot.com/)

This is one of Ruby Central Inc.'s  
Google Summer of Code 2006 projects.

== What is it? ==

A GUI toolkit written in Ruby, using OpenGL for  
drawing and SDL for text and loading images.

Intended for being embedded in other OpenGL  
applications and for stand-alone apps that don’t  
need complex widgets.

See the README in the tarball or at  
[http://glimr.blogspot.com/2006/07/glimr-010.html](http://glimr.blogspot.com/2006/07/glimr-010.html)  
for more.

Take it for a spin if you like, there are small  
example programs focusing on different  
aspects of the toolkit in  
tests/integration\_tests/

== Requirements ==

Ruby \>= 1.8.1, tested to run on YARV (but encountered some segfaults)  
ruby-opengl  
Ruby/SDL with TTF support ( [Ruby/SDL](http://www.kmc.gr.jp/~ohai/rubysdl.en.html) )

Tested to run on Linux and Windows,  
should work on OS X too if you  
get SDL\_ttf installed.

Perceptibly faster on Linux than Windows (go figure.)

== Currently implemented widgets ==

- Horizontal and vertical layout
- Buttons, radio buttons, checkboxes
- Scrollbars
- Resizable scrollable container
- Image, strechable image
- Text labels, single-line text input
- Simple theme system

== Example code ==

require ‘glimr’  
include GlimR

form = VLayout.new(  
:expand\_height =\> true, :expand\_width =\> true,  
:align =\> :center, :valign =\> :middle)

label = Label.new(:text =\> “Enter your name:”)  
name\_input = TextInput.new(:text =\> “”){|o,e|  
form.attach Label.new(:text =\> “Hi, #{e.text}!”)  
}  
submit = Button.new(:label =\> “OK”){|o,e|  
name\_input.submit  
}  
form.attach label, name\_input, submit

window = GLUTWindow.new(400, 200, “Greeter”)  
window.attach form  
window.run

# Ctrl-Q to quit

== Features in development ==

- menus, lists, tables
- multi-line text editor
- keyboard focus management
- clipboard integration
- second theme

P.S.  
Anyone have ideas on what’s causing segfaults on Windows  
when using OpenGL and SDL? Now I’m using a GC.disabled  
critical section to work around them.

---

<div class="post-metadata">

**Author:** ![Ilmari\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a587f6/32.png) [@Ilmari\_H](https://www.ruby-forum.com/u/Ilmari_H)\
**Post date:** [July 16, 2006, 7:12pm UTC](https://www.ruby-forum.com/t/soc-glimr-0-1-0/98556/2 "2006-07-16T19:12:46Z")

</div>

This seems pretty neat, I snagged the gem and ran the little sample  
form below. It seemed a little slugish to respond, but on the  
otherhand it handles resizing and such well from what I could tell.

So yeah, neat 🙂 Want to post some more examples?

Thanks for your project,  
.adam

---

<div class="post-metadata">

**Author:** ![Ilmari\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a587f6/32.png) [@Ilmari\_H](https://www.ruby-forum.com/u/Ilmari_H)\
**Post date:** [July 17, 2006, 1:37am UTC](https://www.ruby-forum.com/t/soc-glimr-0-1-0/98556/3 "2006-07-17T01:37:14Z")

</div>

Hi,

On 7/16/06, Adam S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This seems pretty neat, I snagged the gem and ran the little sample  
> form below. It seemed a little slugish to respond, but on the  
> otherhand it handles resizing and such well from what I could tell.

Thanks for trying it out 🙂  
Btw, what were the parts being sluggish? Text input? Everything?  
Could you also tell what OS and hardware you ran it on?  
I’ll try to fix performance in a later release (after coding the main  
features)

> So yeah, neat 🙂 Want to post some more examples?

Sure!  
Here’s an image viewer (beware, if an image is larger  
than max OpenGL texture size (usually 2048x2048 or more),  
it won’t show it):

files = Dir[“_._”].grep(/.(jpg|png)$/i)  
require ‘glimr’  
include GlimR

sc = ScrollableContainer.new(  
:content =\> Image.load(files.first))

sc.container.on\_click{|o,e|  
case e.button  
when :left  
files.push files.shift  
sc.content.load(files.first)  
when :right  
files.unshift files.pop  
sc.content.load(files.first)  
end  
}

w = GLUTWindow.new  
w.attach sc  
w.run

That one had bad performance on Windows,  
on Linux it’s a lot smoother for some reason.

I put the integration\_tests sample code online at  
[http://glimr.rubyforge.org/samples/](http://glimr.rubyforge.org/samples/)

> Thanks for your project,  
> .adam

Cheers,  
Ilmari
