Jump to content
  • Advertisement
Sign in to follow this  

SDL/OpenGL Blending

This topic is 2820 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

Hi guys edited this post due to location my problem (my original post was way off the mark), basically when I load an image using IMg_Load libery I then have to convert this image to 2^n dimensions for OpenGL blending. The way I go about this is to create a new surface with the same color format as the original one then simply blit the old onto the new. This causes a side effect, for some reason alpha is spread across the whole of the image making the background image show through. Any Ideas on how to prevent this, I have tried calling SDL_SetAlpha but nothing changed.

Here's my surface code

surface = SDL_CreateRGBSurface( SDL_SWSURFACE, Get2nNumber( origionalSurface->w ) , Get2nNumber( origionalSurface->h ), origionalSurface->format->BitsPerPixel, origionalSurface->format->Rmask, origionalSurface->format->Gmask, origionalSurface->format->Bmask, origionalSurface->format->Amask );
SDL_Rect corner;
corner.x = 0;
corner.y = 0;

SDL_BlitSurface( origionalSurface, NULL, surface, &corner );

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!