OpenGL with SDL Blitting

Hey All,

So i'm using SDL on top of previously created GL images (using glVertex). I have everything setup through SDL but my bitmap images are not drawing at all on my SDLScreen.

Here's the initialization (and a relevant function) of my screen, in "VideoGame.cpp":

1
2
3
4
5
SDL_Surface* drawContext = SDL_SetVideoMode(1024, 1024, 32, nFlags);

SDL_Surface* getSurface() {
	return drawContext;
}


Here's my draw code for my bitmap image (in "Player.cpp"):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
SDL_Surface *temp;

temp = SDL_LoadBMP("Sprites/sprite.bmp")

if (temp == NULL) {
	printf("Unable to load bitmap: %s\n", SDL_GetError());
	exit(1);
}

SDL_SetColorKey( temp, SDL_SRCCOLORKEY | SDL_RLEACCEL, 
       SDL_MapRGB( temp->format, 255, 0, 255) );

image = SDL_DisplayFormat(temp);
SDL_FreeSurface(temp);

SDL_UnlockSurface( getSurface() );
SDL_UnlockSurface( image );

//Code to properly interpolate "GL Coordinates" to Pixel coordinates
//Assigns values into drawX and drawY

SDL_Rect rect = {drawX,drawY, 64, 64};

int worked = SDL_BlitSurface(image, NULL, getSurface(), &rect);
//printing worked displays '0', which is a success

SDL_UpdateRects( getSurface(), 1, &rect );


I'm receiving NO COMPILER or LINKER errors. The image is just not drawing.

Any help would be most excellent. Even if you think it's something minor...i'm desperate.

Thanks,
Dominic
try adding
SDL_Flip(getSurface());
to the end. not entirely sure if that's correct but worth a try.



Azriel~
Topic archived. No new replies allowed.