Blitting OpenGL texture

Hi, I’m using SDL and OpenGL to make a 2D game. I have my sprites as 1
long PNG file with all the frames of animation, what I want to do is
blit the frame I want into an opengl texture. This is the code I’m using:

SDL_Surface* m_gSprites(IMG_Load(“sprites.png”));
glGenTextures(1, &m_nTextureID);
glBindTexture(GL_TEXTURE_2D, m_nTextureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

SDL_Rect tSrcRect;
SDL_Rect tDesRect;
tSrcRect.x = 0;
tSrcRect.y = m_iSizem_iFrame;
tSrcRect.w = m_iSize;
tSrcRect.h = m_iSize;
tDesRect.x = 0;
tDesRect.y = 0;
SDL_Surface
tSurface(SDL_CreateRGBSurface(SDL_SWSURFACE, m_iSize,
m_iSize, 32, rmask, gmask, bmask, amask));
SDL_BlitSurface(m_gSprites, &tSrcRect, tSurface, &tDesRect);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_iSize, m_iSize, 0, GL_RGBA,
GL_UNSIGNED_BYTE, tSurface->pixels);

This results in a totally empty texture, but if i add this before blitting:

SDL_FillRect(tSurface, NULL, 0x55ffffff);

I can see it’s copied the texture fine but is semi-transparent like the
rectangle I filled it with, it seems to be using the alpha from the
destination surface. Am I missing something I need to apply to the
destination surface before blitting?

Thanks–
Ryan Williams
http://ryanwilliams.org

I managed to get the effect I wanted using:

SDL_SetAlpha(m_gSprites, SDL_RLEACCEL, 128);

this completely replaces the destination surface’s alpha, but its there
a way to do blending between the two surfaces?