[SDL] SDL/OpenGL and texture mapping.
paul at theV.net
paul at theV.net
Tue Sep 10 22:15:01 PDT 2002
My guess the problem of using surfaces returned by SDL_LoadBMP()
or IMG_Load() as GL texture source is mainly something to do with
different surface encoding format. SDL may not return the ideal
RGB or RGBA format that GL expects. It is the same reason why a
SDL_DisplayFormat() or SDL_DisplayFormatAlpha() would speed up
blitting to the main screen surface. I am not very sure after you
enable OpenGL with SDL, SDL_DisplayFormat() will do the right
conversion work to ease texture loading for you... can somebody
verify and confirm this?
But from what David Olofson has also done in his glSDL
implementation, he is also creating a proper RGB/RGBA surface and
blit image over before feeding it as texture.
Alpha channel or not seems to be different issue here.
On Tue, Sep 10, 2002 at 07:04:32PM +0200, Arne wrote:
> > Ok, this conbined with Matthias's code works beautifully. So my problem
> > is that my image even though I used SDL_LoadBMP or IMG_Load does not
> > return a 32-bit image? Therefore I have to set the surface manually and
> > blit to that surface to create a 32bit image?
> If you save your image as 24bit, you will get 24bit and thus no alpha
> channel. I remeber a possibility where you can swith Alpha on manually,
> but I'm not nquite sure about this - have a look at the SDL_Surface
> You also asked why there is a Problem with the image loading routine ...
> That's an endian problem - Intel and Motorolla (e.g.) are using
> different methods of placing bytes in memory.
> Those methods are known as little endian or big endian. The one system
> stores the lowest byte on the lets say right side of the block, the
> other system on the left. So if you see this in RGBA you have RGBA on
> the one system and ABGR on the other. That's the origin of the problem.
> SDL mailing list
> SDL at libsdl.org
More information about the SDL