Sign in to follow this  

Loading TGAs with SDL+SDLImage+OpenGL

This topic is 4726 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm with troubles loading TGAs with transparency(Alpha channel), using SDL + OpenGL and SDLImage to load the TGA(Since SDL only loads bmp). The image loads, but it's been disfigurated? The colors become crazy or someting... Only using the SDL to display the image with the SDLsurface, the image looks great. But using a OpenGL surface, becomes crazy. What happens? Look at: http://geocities.yahoo.com.br/megaspeedlinux/snap.jpg

Share this post


Link to post
Share on other sites
OK! That's it.
But the image do'nt show the alpha.
The rose color is a alpha channel, but is showing?

Look at:
http://geocities.yahoo.com.br/megaspeedlinux/snap1.jpg

Share this post


Link to post
Share on other sites
Are you using blending? Without it, the alpha won't be used.

Try glEnable(GL_BLEND); and glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); for example.

Share this post


Link to post
Share on other sites
Strange... I tried now with other image(a bit different), but the image don't load correctly
-> http://geocities.yahoo.com.br/megaspeedlinux/img.tga.zip
This is the image i'm trying to load, and i'm using like said:
glEnable( GL_BLEND );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

and...
glTranslatef( -0.578f, 0.2f, -1.4f );
glBindTexture( GL_TEXTURE_2D, texture[72] );
glBegin(GL_QUADS);
glTexCoord2f( 0.0f, 1.0f ); glVertex3f( -0.11f, -0.11f, 0.0f );
glTexCoord2f( 1.0f, 1.0f ); glVertex3f( 0.11f, -0.11f, 0.0f );
glTexCoord2f( 1.0f, 0.0f ); glVertex3f( 0.11f, 0.1f, 0.0f );
glTexCoord2f( 0.0f, 0.0f ); glVertex3f( -0.11f, 0.1f, 0.0f );
glEnd( );

Works for the other textures, but not for that. What is wrong?

Share this post


Link to post
Share on other sites

This topic is 4726 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this