Ruby/Opengl and RUDL

K

Kyle Pinkman

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. >.>'
 
B

Bill Kelly

From: "Kyle Pinkman said:
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
 
K

Kyle Pinkman

Bill said:
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..
 
K

Kyle Pinkman

Jason said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top