apviper / gmail.com wrote:

>I've been playing around with ruby-opengl lately, and I've run into a
>hitch.  While I found a way to load images via the imlib bindings
>(found on this group:), I'd still like to be able to convert RUDL
>surfaces to OpenGL texutres, just so I can use their bindings to
>SDL_TTF for text manipulation.
>
>Can anyone point me in the right direction?  I've looked at the
>rubynehe folder that came with RUDL, but that method seemed to work
>with only certain surfaces.
>
 From my RudloidGL game, ResourceMgr class (temp is a RUDL surface):

    def ResourceMgr.tex_from_image(temp, name)
        @textures[name]=GL.GenTextures(1)[0]
        GL.BindTexture(GL::TEXTURE_2D, @textures[name])
        GL.TexParameteri(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::LINEAR)
        GL.TexParameteri(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::LINEAR)
        GL.TexImage2D(GL::TEXTURE_2D, 0, GL::RGBA8, temp.w, temp.h, 0, 
GL::RGBA, GL::UNSIGNED_BYTE, temp.pixels)
        GLU.Build2DMipmaps(GL::TEXTURE_2D, 4, temp.w, temp.h, GL::RGBA, 
GL::UNSIGNED_BYTE, temp.pixels)
       
        debug_print "new texture: ",name,"  ---ID: ",@textures[name],"\n"
        @textures[name]
    end

Is that what you're looking for? (For RUDL surfaces without alpha you'll 
have to use OpenGL constants without the 'A')
Perhaps I'll release my game someday, it's been in development for about 
3 years now (5 days per year ;))
http://landesjugendtheater.at/misc/rudloidWIP4.jpg
http://landesjugendtheater.at/misc/rudloidEditWIP3.jpg

- Peter