[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Ruby/Opengl and RUDL

Kyle Pinkman

10/4/2006 2:32:00 AM

I am using RUDL, to create a 2D engine in Opengl... I cant find anything
that would cause for this great deal of lag I am getting, other then the
fact I have 17 polygons. I'm.. not sure why it would lag so much over
only 17 polygons.. I do not think there are any memory leaks, because
textures and what not are initialized once, and are pretty safe.
Although... there is still this huge lag.. when I take away the
polygons, the lag is gone, when I add them back in. The lag is back, and
reasons this could be? Anything I could do to fix it? (dont ask me why
im using opengl to make a 3D engine, I just want too. >.>'

--
Posted via http://www.ruby-....

3 Answers

Bill Kelly

10/4/2006 6:06:00 PM

0

From: "Kyle Pinkman" <pinkmanonfire@gmail.com>
>
>I am using RUDL, to create a 2D engine in Opengl... I cant find anything
> that would cause for this great deal of lag I am getting, other then the
> fact I have 17 polygons. I'm.. not sure why it would lag so much over
> only 17 polygons.. I do not think there are any memory leaks, because
> textures and what not are initialized once, and are pretty safe.
> Although... there is still this huge lag.. when I take away the
> polygons, the lag is gone, when I add them back in. The lag is back, and
> reasons this could be? Anything I could do to fix it? (dont ask me why
> im using opengl to make a 3D engine, I just want too. >.>'

Hi,

Is the lag the same, no matter what size the polygons are? I.e. if you
draw 17 very small polygons, does it lag still?



Regards,

Bill



Kyle Pinkman

10/4/2006 9:53:00 PM

0

Bill Kelly wrote:
> From: "Kyle Pinkman" <pinkmanonfire@gmail.com>
>>
>>I am using RUDL, to create a 2D engine in Opengl... I cant find anything
>> that would cause for this great deal of lag I am getting, other then the
>> fact I have 17 polygons. I'm.. not sure why it would lag so much over
>> only 17 polygons.. I do not think there are any memory leaks, because
>> textures and what not are initialized once, and are pretty safe.
>> Although... there is still this huge lag.. when I take away the
>> polygons, the lag is gone, when I add them back in. The lag is back, and
>> reasons this could be? Anything I could do to fix it? (dont ask me why
>> im using opengl to make a 3D engine, I just want too. >.>'
>
> Hi,
>
> Is the lag the same, no matter what size the polygons are? I.e. if you
> draw 17 very small polygons, does it lag still?
>
>
>
> Regards,
>
> Bill

I was thinking it was most obviously the polygons size, and how close it
was to the camra.. although the size it only 640x480px or 6.4x4.8...
although, that is only two polygons. Then there are 15 small ones, with
the width of 640px and the height of 32px that run down the window
equalling the size of the other two larger polygons..

The code is..
GL.PushMatrix
GL.Enable GL::TEXTURE_2D
GL.BindTexture(GL::TEXTURE_2D, @layer_2.draw);
15.times do |i|
GL.Begin(GL::QUADS);
w = 0.625
h = 0.46875
y = 0.32 * i
oy = i * (h/15)
GL.TexCoord 0, 0
GL.Vertex 0, 0,1.99
GL.TexCoord w, 0
GL.Vertex 6.4, 0,1.99
GL.TexCoord w,oy
GL.Vertex 6.4, y,1.99
GL.TexCoord 0,oy
GL.Vertex 0.0, y,1.99
GL.End();
end
GL.Disable GL::TEXTURE_2D
GL.PopMatrix
although, thats only for the 15 polygons that run down..

If it is(most like is) the size of the polygons, wich is causing the
lag, is there any way to fix that?

...

and..

>You're gonna have to post your drawing code. Also, do you have a GFX? or
>are
>you running through Mesa?

I am not sure what you mean..


--
Posted via http://www.ruby-....

Kyle Pinkman

10/5/2006 1:21:00 PM

0

Jason Roelofs wrote:
>>
>>
> Your code looks fine, it's using what's called Immediate Mode and with
> only
> 15 Quads, should be fast enough if you've got any semblance of hardware
> support. (For the record, 15 Quads gets translated internally to
> polygons,
> so you're at about 30 polies). What are the system specs of your
> computer?
> By GFX I mean Graphics Card. If you don't have hardware OpenGL support,
> then
> you're running through Mesa, the OpenGL software renderer, which is
> extremely slow and on top of Ruby for what may be a slow system, then
> it's
> not going to take long before your computer starts chugging. So if you
> can
> post your computer specs, we'll see what's going on.
>
> Jason

I do not have a graphics card.. but im not sure if that would explain
the lagging, because I have had people test it as well and it lagged for
them, and alot of them have nice graphics cards and lots of ram.. also,
I have made this simular thing in c to test, and it didnt lag at all in
C.. so im not sure.

--
Posted via http://www.ruby-....