I am having problems getting textures to load in SDL 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 edit I made of some RUDL code I had.. the problem is, that its not seeming to well.. work, and I am getting this error:
---------------------------
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
---------------------------
Wich really doesnt tell me anything, or how to fix, if anyone can show me a working way to load textures in OpenGL with SDL, please do.. cause I am in a hurry, if not, fix my code perhaps? because that is the only place the error comes from, cause if I take that out, then it works fine, so please, if someone can help, would be appreciated.
|