How to load a Texture in Ruby-Opengl

O

onionblossom

Hi,

I don't get it working in Ruby. I try to load a texture which works
pretty easy in other languages like c++ and there are plenty of
examples in other languages but none for Ruby.

The file could be any format but I like to keep it simple: ppm or raw.
Can anyone give me a hint or a snippet how to do it?

thanx ahead
 
J

Jan Dvorak

Hi,

I don't get it working in Ruby. I try to load a texture which works
pretty easy in other languages like c++ and there are plenty of
examples in other languages but none for Ruby.

The file could be any format but I like to keep it simple: ppm or raw.
Can anyone give me a hint or a snippet how to do it?

It works the same way as in C or other languages, you need library (like
RMagick/ImageMagick,SDL_image etc.) that decodes the image format to raw
pixel data in memory (in ruby it's represented as string), then pass it to
the opengl functions (glTexImage*).

Jan
 

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,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top