[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby and 2D graphics

Philip Müller

3/24/2009 8:01:00 PM

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
20 Answers

Rolando Abarca

3/24/2009 8:08:00 PM

0

I would recomend you gosu:

http://www.li...

On Mar 24, 2009, at 4:01 PM, Philip M=FCller wrote:

> Hi everybody,
>
> I'm searching for a way to get simple graphical output in ruby for a =20=

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


regards,
--=20
Rolando Abarca M.





Peter Zotov

3/24/2009 8:09:00 PM

0

Quoting "Philip M=C3=BCller" <me@alienemperor.de>:

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

I used Ruby/OpenGL in my physics simulator. It gave me 60 fps on ~20 =20
objects w/out physics or 30 with it. Fast enough for me. I have NVidia =20
Geforce FX 5200 and Athlon 64 3000+.

--
WBR, Peter Zotov

Joel VanderWerf

3/24/2009 8:12:00 PM

0

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

I mentioned tkar, my own tool for this purpose, on the list a few weeks ago:

http://groups.google.com/group/ruby-talk-google/browse_thread/thread/268d3a...

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.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Philip Müller

3/24/2009 8:18:00 PM

0

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)

Jason Roelofs

3/24/2009 8:20:00 PM

0

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/tut...

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

Jason

On Tue, Mar 24, 2009 at 4:16 PM, Philip M=FCller <me@alienemperor.de> wrote=
:
> 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 w=
arm
> for the rest of his life.
> -- Terry Prattchett -- Jingo (1997)
>
>

Peter Zotov

3/24/2009 8:23:00 PM

0

Quoting "Philip M=C3=BCller" <me@alienemperor.de>:
> On Tue, 24 Mar 2009 21:08:34 +0100, Peter Zotov =20
> <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 =20
> get documentation for that?

They have a site, http://ruby-opengl.ruby.... There are also a =20
nice tutorial, but I found examples that were shipped with gem =20
(ruby-opengl) more informative. Or you can browse them at SVN =20
(http://ruby-opengl.ruby...svn/trunk/examples/). Unfortunately, =20
I cannot give you sources of my simulator, they probably were lost.

--
WBR, Peter Zotov

Shawn Anderson

3/24/2009 8:33:00 PM

0

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.co...

A sample Asteroids clone w/ physics is available here:

http://...

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


On Tue, Mar 24, 2009 at 1:23 PM, Peter Zotov <whitequark@whitequark.ru>wrot=
e:

> Quoting "Philip M=FCller" <me@alienemperor.de>:
>
>> On Tue, 24 Mar 2009 21:08:34 +0100, Peter Zotov <whitequark@whitequark.r=
u>
>> 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.ruby.... There are also a nic=
e
> tutorial, but I found examples that were shipped with gem (ruby-opengl) m=
ore
> informative. Or you can browse them at SVN (
> http://ruby-opengl.ruby...svn/trunk/examples/). Unfortunately, I
> cannot give you sources of my simulator, they probably were lost.
>
> --
> WBR, Peter Zotov
>
>

Philip Müller

3/24/2009 9:26:00 PM

0

On Tue, 24 Mar 2009 21:08:12 +0100, Rolando Abarca <funkaster@gmail.com>
wrote:

> I would recomend you gosu:
>
> http://www.li...

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

Adam Gardner

3/24/2009 9:35:00 PM

0

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.li...
>
> 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.li...cgi-bin/mwf/forum_show.pl
--
Posted via http://www.ruby-....

Philip Müller

3/24/2009 9:49:00 PM

0

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/GettingStar...
and installed the prerequisites.
Seems to work now.

Philip