[ruby-opengl-devel] ruby-opengl and RMagick

Jan Dvorak jan.dvorak at kraxnet.cz
Sun Oct 14 19:29:42 EDT 2007


On Monday 15 October 2007 00:50, Cassius Rosenthal wrote:
> Hello all,
>
> I am interested in using opengl to resize images.  I have ruby-opengl
> running, and in irb I'm trying to pass an RMagick image to
> GL.TexImage2D, but I get a type error.  The roadmap page on the web site
> says, "Add image handling wrapper for easy image handling."  Obviously
> that hasn't been implemented yet, but I am encouraged that I'm not the
> only one interested in functionality like that.
In short, you can use @image.export_pixels_to_str function (with no parameters 
it exports in GL_RGB/GL_UNSIGNED_BYTE format)

For passing data back from OpenGL to RMagick, similarly use import_pixels, as 
in:

pixels = Gl.glGetTexImage(...)

image = Magick::Image.new(...)
image.import_pixels(0, 0, width, height, "RGB", pixels, ... )

Jan


More information about the ruby-opengl-devel mailing list