Ruby,SDL,OpenGL

K

Kyle Pinkman

This is in regards to my last topic, where I was having problems with
lag, I got around to thinking that maybe it was just the way RUDL
handled opengl, and somehow caused lag, so I thought I'd go ahead and
try in normal SDL, now.. so far I am running 32 polygons, and am at 200+
fps, rather then the old 20+ fps, it seems to be working perfectly now,
all for the fact SDL doesnt give me a good error message.. IE:
---------------------------
rubyw.exe - Application Error
---------------------------
The exception Breakpoint

A breakpoint has been reached.

(0x80000003) occurred in the application at location 0x7c901230.


Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------

although, I know where the problem is located, just not sure what to do
to fix it, seeing how that error is no help. It could be anything. But I
at least know its because of my code, I cant seem to load a texture
inopengl with the SDL library.. my code so far is

def load_texture(texture,arr)
if (texture.nil?)
exit
end
#texture.convert!
texture.setColorKey SDL::SRCCOLORKEY, texture[0,0]
texture = texture.displayFormat
image = SDL::Surface.new(SDL::SRCCOLORKEY | SDL::SRCALPHA,
[texture.w,texture.h], 32, [0x000000FF, 0x0000FF00, 0x00FF0000,
0xFF000000])
#image.fill [0,0,0,0]
image.put(texture, [0,0])
image = image.displayFormat
GL.BindTexture(GL::TEXTURE_2D,arr[0]);
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::LINEAR);
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::LINEAR);
GL.TexImage2D(GL::TEXTURE_2D, 0, GL::RGBA,image.w, image.h, 0,
GL::RGBA, GL::UNSIGNED_BYTE, image.pixels)
end

wich is a quick transformation from the RUDL version to SDL.. if anyone
knows how to load textures with SDL, tell me.. I am achen to get this to
work.
 
A

anne001

Maybe running your program in opengl would help, you would know if the
problem was opengl or sdl.

I have opengl from yoshi running on my mac if you want me to try your
program, or if you are on pc, maybe you could download and install it

Please post what you learn, there are not many people working with
opengl/ruby who post on the list.
 
K

Kyle Pinkman

anne001 said:
Maybe running your program in opengl would help, you would know if the
problem was opengl or sdl.

I have opengl from yoshi running on my mac if you want me to try your
program, or if you are on pc, maybe you could download and install it

Please post what you learn, there are not many people working with
opengl/ruby who post on the list.

it isnt my opengl code its the sdl.. just need to know how to make the
correct surface to load in the opengl texture module
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top