Forum: Ruby ruby and 2D graphics

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
887b6077c9bf05507c7adbce6e746f8b?d=identicon&s=25 Philip Müller (alienemperor)
on 2009-03-24 21:05
(Received via mailing list)
Hi everybody,

I'm searching for a way to get simple graphical output in ruby for a
simple physics simulation. All I need are circles and lines and a decent
framerate in fullscreen-like resolutions. I tried ruby-processing but in
800*600 i get less than 10 frames on my not-too-old pc. And that's just
a
circle moving around, no physics whatsoever involved.

Thanks for your input

Philip
79caabff3b239b1bee6de8c51bc7f78c?d=identicon&s=25 Rolando Abarca (Guest)
on 2009-03-24 21:12
(Received via mailing list)
I would recomend you gosu:

http://www.libgosu.org/

On Mar 24, 2009, at 4:01 PM, Philip Müller wrote:

>
> Philip


regards,
2a2ef2adb5f48cfec60ba3c3b381eead?d=identicon&s=25 Peter Zotov (Guest)
on 2009-03-24 21:12
(Received via mailing list)
Quoting "Philip Müller" <me@alienemperor.de>:

> I'm searching for a way to get simple graphical output in ruby for a
> simple physics simulation. All I need are circles and lines and a
> decent framerate in fullscreen-like resolutions. I tried
> ruby-processing but in 800*600 i get less than 10 frames on my
> not-too-old pc. And that's just a circle moving around, no physics
> whatsoever involved.

I used Ruby/OpenGL in my physics simulator. It gave me 60 fps on ~20
objects w/out physics or 30 with it. Fast enough for me. I have NVidia
Geforce FX 5200 and Athlon 64 3000+.
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-03-24 21:15
(Received via mailing list)
Philip Müller wrote:
> Philip
I mentioned tkar, my own tool for this purpose, on the list a few weeks
ago:

http://groups.google.com/group/ruby-talk-google/br...

It's written in ruby, but you can pipe it data from anything, and it
even embeds as a simulink block.

It's based on the tk canvas, which is really pretty good for simple
purposes, and easy to make interactive.
887b6077c9bf05507c7adbce6e746f8b?d=identicon&s=25 Philip Müller (alienemperor)
on 2009-03-24 21:20
(Received via mailing list)
On Tue, 24 Mar 2009 21:08:34 +0100, Peter Zotov
<whitequark@whitequark.ru>
wrote:
> I used Ruby/OpenGL in my physics simulator.

Interesting. What do I need to use OpenGL in ruby and where can I get
documentation for that?

Philip

--

Give a man a fire and he's warm for a day, but set fire to him and he's
warm for the rest of his life.
-- Terry Prattchett -- Jingo (1997)
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2009-03-24 21:24
(Received via mailing list)
Ruby/OpenGL is a 1-1 mapping of the functions under the GL module.
Just grab the ruby-opengl gem and start writing, basically.

http://ruby-opengl.rubyforge.org/tutorial.html

And I'll second on Gosu. Good library. That, and rubygame.

Jason
2a2ef2adb5f48cfec60ba3c3b381eead?d=identicon&s=25 Peter Zotov (Guest)
on 2009-03-24 21:27
(Received via mailing list)
Quoting "Philip Müller" <me@alienemperor.de>:
> On Tue, 24 Mar 2009 21:08:34 +0100, Peter Zotov
> <whitequark@whitequark.ru> wrote:
>> I used Ruby/OpenGL in my physics simulator.
>
> Interesting. What do I need to use OpenGL in ruby and where can I
> get documentation for that?

They have a site, http://ruby-opengl.rubyforge.org/. There are also a
nice tutorial, but I found examples that were shipped with gem
(ruby-opengl) more informative. Or you can browse them at SVN
(http://ruby-opengl.rubyforge.org/svn/trunk/examples/). Unfortunately,
I cannot give you sources of my simulator, they probably were lost.
81b5e41ae80dc7f1aa57d2bf40e7e7d0?d=identicon&s=25 Shawn Anderson (Guest)
on 2009-03-24 21:38
(Received via mailing list)
Rubygame and Gosu are great options. I use Rubygame; I have started a
framework on top of it to make simple game objects with physics attached
easy to setup and run.

It's still very much alpha, but may suit your needs:
http://shawn42.github.com/gamebox/

A sample Asteroids clone w/ physics is available here:

http://is.gd/oLTI

If it looks to meet your needs, I can walk you through setting up
Rubygame/Gamebox for yourself (as the documentation is incomplete at the
moment).

/Shawn
887b6077c9bf05507c7adbce6e746f8b?d=identicon&s=25 Philip Müller (alienemperor)
on 2009-03-24 22:31
(Received via mailing list)
On Tue, 24 Mar 2009 21:08:12 +0100, Rolando Abarca <funkaster@gmail.com>
wrote:

> I would recomend you gosu:
>
> http://www.libgosu.org/

ok, maybe this is getting off-topic now, but when I

sudo gem install gosu

i get

Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

I have no idea where to search for this mkmf.log file and I have no idea
why it fails in the first place.

If this is off-topic here please direct me somewhere where it fits.

thanks
Philip
Eacf5ed623e72db0b87707baabd6f21a?d=identicon&s=25 Adam Gardner (adamgardner)
on 2009-03-24 22:37
Philip Müller wrote:
> On Tue, 24 Mar 2009 21:08:12 +0100, Rolando Abarca <funkaster@gmail.com>
> wrote:
>
>> I would recomend you gosu:
>>
>> http://www.libgosu.org/
>
> ok, maybe this is getting off-topic now, but when I
>
> sudo gem install gosu
>
> i get
>
> Could not create Makefile due to some reason, probably lack of
> necessary libraries and/or headers.  Check the mkmf.log file for more
> details.  You may need configuration options.
>
> I have no idea where to search for this mkmf.log file and I have no idea
> why it fails in the first place.
>
> If this is off-topic here please direct me somewhere where it fits.
>
> thanks
> Philip

That's... pretty weird. That never happens to me when I'm using gosu.
I'd ask you what platform you're using, but perhaps a better idea would
be for me to direct your questions to the official Gosu forums:
http://www.libgosu.org/cgi-bin/mwf/forum_show.pl
887b6077c9bf05507c7adbce6e746f8b?d=identicon&s=25 Philip Müller (alienemperor)
on 2009-03-24 22:50
(Received via mailing list)
On Tue, 24 Mar 2009 22:26:22 +0100, Philip Müller <me@alienemperor.de>
wrote:
> when I
>
> sudo gem install gosu
>
> i get
>
> Could not create Makefile due to some reason,

nevermind.
I should have RTFM ->
http://code.google.com/p/gosu/wiki/GettingStartedOnLinux
and installed the prerequisites.
Seems to work now.

Philip
E7fe24cfaaf8af56ae28f63c81363172?d=identicon&s=25 Jimmy Kofler (koflerjim)
on 2009-03-25 10:17
> Philip Müller wrote:
> Hi everybody,
>
> I'm searching for a way to get simple graphical output in ruby for a
> simple physics simulation. All I need are circles and lines and a decent
> framerate in fullscreen-like resolutions. I tried ruby-processing but in
> 800*600 i get less than 10 frames on my not-too-old pc. And that's just
> a
> circle moving around, no physics whatsoever involved.
>
> Thanks for your input
>
> Philip

Two more options:

1.

Chipmunk

2D video games engine; 2D graphics library

http://wiki.slembcke.net/main/published/Chipmunk

http://code.google.com/p/gosu/wiki/RubyChipmunkIntegration


2.

GLFW

a free, Open Source, portable framework for OpenGL application
development

http://ruby-glfw.rubyforge.org

Cheers,

j.k.
F7b23ca97e51ae89341a19548aa63467?d=identicon&s=25 Tom Reilly (Guest)
on 2009-03-25 13:43
(Received via mailing list)
Can anyone tell me how to correct the following error?

RUBY PROGRAM:
---------------------

require 'sqlite3'
p "open db"
db = SQLite3::Database.new( "data.db" )
p "db close"
db.close

-------------------
ERROR:

 >ruby dbtest.rb
./sqlite3.dll: 127: The specified procedure could not be found.   -
Init_sqlite3 (LoadError)
./sqlite3.dll    from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
    from dbtest.rb:2
 >Exit code: 1

-------------------
SYSTEM CONFIGURATION

Windows Vista
sqlite3.dll is in the same directory as the program - windows version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
gem sqlite3-ruby-1.2.0-mswin32

I'd appreciate any information available.
Thanks
Tom Reilly
666b4e17b4bb0e2d999037a25f65a7cb?d=identicon&s=25 Heesob Park (phasis)
on 2009-03-25 15:18
(Received via mailing list)
2009/3/25 Tom Reilly <w3gat@nwlagardener.org>:
>
>
> -------------------
> SYSTEM CONFIGURATION
>
> Windows Vista
> sqlite3.dll is in the same directory as the program - windows version
> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
> gem sqlite3-ruby-1.2.0-mswin32
>
Move sqlite3.dll to somewhere in your PATH.

Refer to
http://groups.google.com/group/comp.lang.ruby/brow...

Regards,

Park Heesob
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2009-03-25 16:06
(Received via mailing list)
On Mar 25, 2009, at 9:13 AM, Heesob Park wrote:

>> db.close
>>   from dbtest.rb:2
> Move sqlite3.dll to somewhere in your PATH.
>
> Refer to 
http://groups.google.com/group/comp.lang.ruby/brow...

Or switch to Amalgalite so you don't have to worry about issues like
this.  :)

James Edward Gray II
688cbfb30e1a2765586c0fd5d97dee95?d=identicon&s=25 unknown (Guest)
on 2009-03-25 16:59
(Received via mailing list)
Hi,
Can anybody give some examples or link for  debugging a ruby script.

Thanks,
Anil kumar
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-03-25 17:20
(Received via mailing list)
On Wed, Mar 25, 2009 at 11:55 AM, <ext-golla.anil-kumar@nokia.com>
wrote:

>
> Hi,
> Can anybody give some examples or link for  debugging a ruby script.
>
> Thanks,
> Anil kumar
>
>
http://www.datanoise.com/articles/2006/7/12/tutori...


--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2009-03-25 19:56
(Received via mailing list)
On Mar 25, 2009, at 08:55 , <ext-golla.anil-kumar@nokia.com>
<ext-golla.anil-kumar@nokia.com
 > wrote:

>
> Hi,
> Can anybody give some examples or link for  debugging a ruby script.

Please don't thread hijack. It bothers those of us who use real mail
clients.
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2009-03-25 19:57
(Received via mailing list)
On Mar 25, 2009, at 05:38 , Tom Reilly wrote:

> Can anyone tell me how to correct the following error?

Please don't thread hijack. It bothers those of us who use real mail
clients.
F7b23ca97e51ae89341a19548aa63467?d=identicon&s=25 Tom Reilly (Guest)
on 2009-03-26 02:47
(Received via mailing list)
So educate me --
Exactly what is thread hijacking?  Never heard of it before
TR
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-03-26 03:00
(Received via mailing list)
Tom Reilly wrote:

> Exactly what is thread hijacking?  Never heard of it before

It might be when one hits "Reply To", changes the Subject line, and
changes the
contents.

Some forum readers (often referred to as "real" ones) can sort posts by
thread,
even as the Subject changes, relying on secret headers that link posts
for this
purpose.

To ask a new question, hit Post or New Message, not Reply To.
9630ff9880eab934f14f7aa68930e060?d=identicon&s=25 Andras Horvath (log69)
on 2013-06-22 15:56
I know this topic is rather old but I was struggling with the same issue
and since I came up with a solution, I decided to provide it here.

You can find instructions for installing the runtime environment for
Linux platform commented in the beginning of the source code.

My sample code on pastebin:
http://pastebin.com/iC2y221x

All of my related codes in my github repo (sdl_testX.rb):
https://github.com/log69/myscripts
This topic is locked and can not be replied to.