Boost logo

Boost Users :

Subject: Re: [Boost-users] gil and OpenGL
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2010-01-12 09:52:48


Ruben Lopez wrote:
> Kenny Riddile wrote:
>> Kenny Riddile wrote:
>>>
>>> I do this to load GIL images as OpenGL textures and it works fine for
>>> me:
>>>
>>> reinterpret_cast<const char*>(
>>> interleaved_view_get_raw_data(imageView) )
>>
>> Also, I've noticed that OpenGL interprets the image data upside down,
>> so I flip it prior to calling glTexImage2D using flipped_up_down_view.
>> Flipping the image data seems to be common practice when loading
>> OpenGL textures based on what I've read online.
> You can flip the image, but it is more efficient to flip the texture
> coordinates on Y (or T) axis. If you have a lot of texture coordinates,
> you can set a texture matrix (glMatrixMode(GL_TEXTURE)) that flips them
> on hardware.

Thanks! I was actually looking for a convenient way to flip all texture
coordinates...I'm still somewhat unfamiliar with OpenGL. I see GLSL
also gives me access to the texture matrices for each texture unit in
the vertex shader, which is exactly what I need :)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net