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.
Philip M. (Guest)
on 2009-03-24 22: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
Rolando A. (Guest)
on 2009-03-24 22: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,
Peter Z. (Guest)
on 2009-03-24 22:12
(Received via mailing list)
Quoting "Philip Müller" <removed_email_address@domain.invalid>:

> 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+.
Joel VanderWerf (Guest)
on 2009-03-24 22: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.
Philip M. (Guest)
on 2009-03-24 22:20
(Received via mailing list)
On Tue, 24 Mar 2009 21:08:34 +0100, Peter Z.
<removed_email_address@domain.invalid>
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 R. (Guest)
on 2009-03-24 22: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
Peter Z. (Guest)
on 2009-03-24 22:27
(Received via mailing list)
Quoting "Philip Müller" <removed_email_address@domain.invalid>:
> On Tue, 24 Mar 2009 21:08:34 +0100, Peter Z.
> <removed_email_address@domain.invalid> 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.
Shawn A. (Guest)
on 2009-03-24 22: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
Philip M. (Guest)
on 2009-03-24 23:31
(Received via mailing list)
On Tue, 24 Mar 2009 21:08:12 +0100, Rolando A. 
<removed_email_address@domain.invalid>
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
Adam G. (Guest)
on 2009-03-24 23:37
Philip Müller wrote:
> On Tue, 24 Mar 2009 21:08:12 +0100, Rolando A. <removed_email_address@domain.invalid>
> 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
Philip M. (Guest)
on 2009-03-24 23:50
(Received via mailing list)
On Tue, 24 Mar 2009 22:26:22 +0100, Philip Müller 
<removed_email_address@domain.invalid>
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
Jimmy K. (Guest)
on 2009-03-25 11: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.
Tom R. (Guest)
on 2009-03-25 14: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 R.
Heesob P. (Guest)
on 2009-03-25 16:18
(Received via mailing list)
2009/3/25 Tom R. <removed_email_address@domain.invalid>:
>
>
> -------------------
> 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 H.
James G. (Guest)
on 2009-03-25 17:06
(Received via mailing list)
On Mar 25, 2009, at 9:13 AM, Heesob P. 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 G. II
unknown (Guest)
on 2009-03-25 17:59
(Received via mailing list)
Hi,
Can anybody give some examples or link for  debugging a ruby script.

Thanks,
Anil kumar
Rick D. (Guest)
on 2009-03-25 18:20
(Received via mailing list)
On Wed, Mar 25, 2009 at 11:55 AM, <removed_email_address@domain.invalid>
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
Ryan D. (Guest)
on 2009-03-25 20:56
(Received via mailing list)
On Mar 25, 2009, at 08:55 , <removed_email_address@domain.invalid>
<removed_email_address@domain.invalid
 > 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.
Ryan D. (Guest)
on 2009-03-25 20:57
(Received via mailing list)
On Mar 25, 2009, at 05:38 , Tom R. 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.
Tom R. (Guest)
on 2009-03-26 03:47
(Received via mailing list)
So educate me --
Exactly what is thread hijacking?  Never heard of it before
TR
Phlip (Guest)
on 2009-03-26 04:00
(Received via mailing list)
Tom R. 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.
Andras H. (Guest)
on 2013-06-22 17: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.