[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

OpenGL 3D gears demo for Ruby

Arto Bendiken

5/1/2005 6:03:00 AM

Hi there,

I'm a recent convert from Python, PHP et al., and aside from more
serious web-related development with Rails, have been playing a bit
with Yoshi's OpenGL/GLUT bindings. I was interested to see how
ruby-opengl performance would compare with C/C++, so I wrote a Ruby
version of the (in)famous spinning 3D gear wheels demo program, which
is often used as a simple benchmark for OpenGL.

(Kudos to Yoshi for the OpenGL bindings: translating from the original
C code was straightforward and only took an hour or so to finish.)

The results were a bit surprising, in a good way. On my Linux computer
with ATI Radeon 9700, the compiled version of the original gears.c
gives an average 1271 FPS, whereas the gears.rb version achieves an
average of 1203 FPS. (Both programs were run for a couple of minutes
and results averaged.) That's only a 6% gap in performance.

Granted this is a fairly simple OpenGL app, but it's certainly easy to
imagine how productive programmers of open-source games, simulations
etc. could be writing Ruby instead of C/C++ as is the norm.

I've attached the Ruby file gears.rb. It only requires the ruby-opengl
extension to run. The code was translated from rev 1.8 of the
GLUT-based gears.c (not the same as glxgears!) included in the Mesa 3D
software package, keeping the structure close to the original, but
wrapping it in a Ruby class. I also added some simple code to do mouse
rotation. If anyone wishes to compare performance with the original
version, it can downloaded from:
http://cvs.freedesktop.org/mesa/Mesa/progs/dem...

Arto Bendiken
19 Answers

Ilmari Heikkinen

5/2/2005 8:29:00 PM

0

su, 2005-05-01 kello 09:02, Arto Bendiken kirjoitti:
> Hi there,

> The results were a bit surprising, in a good way. On my Linux computer
> with ATI Radeon 9700, the compiled version of the original gears.c
> gives an average 1271 FPS, whereas the gears.rb version achieves an
> average of 1203 FPS. (Both programs were run for a couple of minutes
> and results averaged.) That's only a 6% gap in performance.

Hello,
The reason the Ruby version runs fast is because the gears-program uses
display lists and hence the draw function is pretty much limited just by
the speed of OpenGL's display list drawing efficiency.

I did a couple of experiments comparing drawing the gears with and
without display lists and got the following results:

C, using display lists: 3321FPS
Ruby, using display lists: 3033FPS

C, without display lists: 2417FPS
Ruby, without display lists: 90FPS

The 27x speed difference sounds about right..

The gear function could probably be optimized by minimizing the amount
of Ruby math there and doing as much as possible with GL.Translate and
GL.Rotate, since the GPU does those (and fast!).

It's definitely possible to use Ruby for writing GL apps, though good
performance requires doing things in a way that uses GL's
performance-helping things as much as possible (HW T&L, vertex arrays,
display lists, or even writing inner loops and math-intensive parts in
C).


Anxiously waiting for the fast VM(s), :)
Ilmari





Moby

2/15/2009 10:04:00 PM

0

On Sun, 15 Feb 2009 17:48:02 GMT, home@home.org
(Vladimir) wrote:

>EXCERPT FROM ABSTRACT

In how to tie a Noose?

Moby

2/15/2009 10:11:00 PM

0

On Sun, 15 Feb 2009 17:48:06 GMT, home@home.org
(Vladimir) wrote:

>
>> with the understanding that diversity enhances the education of all students.
>
>I still await identification of those studies that show that the
>inclusion of lesser-qualified affirmative action people helps normal
>students,

TOm Sowell

Clarance Thomas

SURELY you wouldn't make a case that HE has any
exceptional ability?

Moby

2/15/2009 10:12:00 PM

0

On Sun, 15 Feb 2009 17:48:10 GMT, home@home.org
(Vladimir) wrote:

>"Kwanzaa itself is a lunatic blend of schmaltzy '60s rhetoric, black
>racism and Marxism

Mayhaps because of the still ever-present racism,
discrimination, and "noose-Dangling" still exhibited by
you people?

Moby

2/15/2009 10:12:00 PM

0

On Sun, 15 Feb 2009 17:48:14 GMT, home@home.org
(Vladimir) wrote:

>Observations
>
>Although chlamydia in women is a widely distributed STD among all
>racial and ethnic groups, trends in positivity in women screened in
>HHS Region X show consistently higher chlamydia positivity among
>minorities (Figure W).

My advice to you?

Keep your mother, sister, and girfriend off the street.

Moby

2/15/2009 10:13:00 PM

0

On Sun, 15 Feb 2009 17:48:17 GMT, home@home.org
(Vladimir) wrote:

>
>Then stop doing it.
>
>People are catching on to your noose hoax.

"hoax"?

nospam

2/15/2009 10:27:00 PM

0



Sowell and Walter Williams need no preferential treatment.

I'd like them to be President and VP of the US.
_______

"I'm glad I got my education before it became fashionable to like
black people." -- Walter Williams, PhD








On Sun, 15 Feb 2009 15:10:50 -0700, Moby@dick.com wrote:

>On Sun, 15 Feb 2009 17:48:06 GMT, home@home.org
>(Vladimir) wrote:
>
>>
>>> with the understanding that diversity enhances the education of all students.
>>
>>I still await identification of those studies that show that the
>>inclusion of lesser-qualified affirmative action people helps normal
>>students,
>
>TOm Sowell
>
>Clarance Thomas
>
>SURELY you wouldn't make a case that HE has any
>exceptional ability?

nospam

2/15/2009 10:27:00 PM

0


Hello, my name is Eboneesha and I just got an award for being the best
speler in class. I got 60 on the speling test, 20 points for being
Black, 10 points for not getting knocked up during the cemester, and
10 points for not bringing any guns to class. The white mutha fucka
who sit next to me is McGee who live in a po section of the Bronx. He
got 97 on the test but no extar points because he be white. Granny
axt me to thank you liberal educators for paving the way to true
equality.

Your frien,
Eboneesha

PS And one day I going to be your medecal docktor.











On Sun, 15 Feb 2009 15:11:45 -0700, Moby@dick.com wrote:

>On Sun, 15 Feb 2009 17:48:10 GMT, home@home.org
>(Vladimir) wrote:
>
>>"Kwanzaa itself is a lunatic blend of schmaltzy '60s rhetoric, black
>>racism and Marxism
>
>Mayhaps because of the still ever-present racism,
>discrimination, and "noose-Dangling" still exhibited by
>you people?

nospam

2/15/2009 10:27:00 PM

0


And so Patrick Chavis who got something like a 37 on his medical
boards test was picked over Alan Bakke who racked in the low 90s.
When Chavis got his medical degree, Ted Kennedy and the other liberals
danced a jig -- no pun intended -- in the aisles of the US Senate,
extolling the virtues of affirmative action.

But then ... the shit hit the fan.

On June 19, 1997, the California Medical Board suspended his license
to practice medicine, citing his ?inability to perform some of the
most basic duties required of a physician.? Finding him guilty of
gross negligence and incompetence in the cases of three patients?one
of whom had died?California Administrative Law Judge Samuel Reyes said
that letting him ?continue in the practice of organized medicine will
endanger the public health, safety and welfare.? Soon after, the Los
Angeles District Attorney announced that Chavis was the object of a
criminal investigation.

According to medical board investigators, Chavis had engaged in
egregious malpractice while performing liposuction procedures on
patients in a body-sculpting practice he had started as a side
business after taking a cosmetic surgery seminar in Beverly Hills. For
doctors looking for easy cash, liposuction had become a lucrative and
largely unregulated business, and Chavis?s New Attitude Body Sculpting
had flourished, even in hardbitten Compton. But the four day short
course Chavis had attended left him inadequately prepared to handle
complications. Patients who lived told harrowing tales of Chavis?s
post operative neglect when the procedures he had performed went bad.

After one botched procedure, Chavis stashed a patient in his home
instead of admitting her to the hospital. Abandoning her for nearly
forty hours, the doctor refused to return the frantic phone calls of
the patient, who lost nearly 70% of her blood and was admitted to a
hospital with a severe abdominal infection. A second patient told an
almost identical story: a botched liposuction, massive internal
bleeding, and Chavis?s almost inhuman indifference to her suffering. A
third patient was not as lucky. After another botched procedure,
Chavis left her in his office for four and half hours, her blood
pressure plummeting from severe abdominal hemorrhage, which left his
clinic floor puddled with blood. By nightfall she was in cardiac
arrest and died while her husband rushed her to the hospital.

Medical board investigators also heard from a doctor who had worked
with Chavis. Citing ?poor impulse control and sensitivity to patients?
pain,? the doctor gave investigators a tape recording of patients
screaming horrifically, with Chavis responding, ?Don?t talk to the
doctor while he is working,? and, ?Liar, liar, pants on fire.? In
addition, Chavis refused to take responsibility for anything that had
happened to his patients. According to investigators, at one point
Chavis said that it was the husband of the dead patient who should be
brought up on charges, claiming that he had picked her up and put her
into a wheelchair after surgery in violation of procedure. At another
point he said he was the victim of a racist medical system that didn?t
like to see a black doctor do well.
________





On Sun, 15 Feb 2009 15:12:22 -0700, Moby@dick.com wrote:

>On Sun, 15 Feb 2009 17:48:14 GMT, home@home.org
>(Vladimir) wrote:
>
>>Observations
>>
>>Although chlamydia in women is a widely distributed STD among all
>>racial and ethnic groups, trends in positivity in women screened in
>>HHS Region X show consistently higher chlamydia positivity among
>>minorities (Figure W).
>
>My advice to you?
>
>Keep your mother, sister, and girfriend off the street.
>

nospam

2/15/2009 10:27:00 PM

0



And so there was this welfare mammy suing her daughter -- who was also
a welfare queen -- for ripping off her cable box. Evidence revealed
that the old lady had three TVs.

Judge Ed Koch: "Mrs Washington, why do you need three TVs?"

She replied, "Well yo 'onna, muh apahtment have three roo ... , two
bedrooms and a livin' room."

BWAHAHAHA!

FDR said, "A chicken in every pot," but with the Great Society handed
down by LBJ it's a TV in every room. Lord help us and now Nobama's
going to ratchet up the goodies.
________


On Sun, 15 Feb 2009 15:11:45 -0700, Moby@dick.com wrote:

>On Sun, 15 Feb 2009 17:48:10 GMT, home@home.org
>(Vladimir) wrote:
>
>>"Kwanzaa itself is a lunatic blend of schmaltzy '60s rhetoric, black
>>racism and Marxism
>
>Mayhaps because of the still ever-present racism,
>discrimination, and "noose-Dangling" still exhibited by
>you people?