How to load a Texture in Ruby-Opengl

Discussion in 'Ruby' started by onionblossom, Jun 19, 2008.

  1. onionblossom

    onionblossom Guest


    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
    onionblossom, Jun 19, 2008
    1. Advertisements

  2. onionblossom

    Jan Dvorak Guest

    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 Dvorak, Jun 20, 2008
    1. Advertisements

  3. onionblossom

    onionblossom Guest

    Thanx, I solved the problem by using the sdl library
    onionblossom, Jun 23, 2008
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.