Bug using Opengl and showing a Surface with an image

Hi,
I try to make an opengl window. I took that one from the docu.
I only added the following code at line 373 before the while(1):

SDL_Surface *image;
SDL_Rect target;
image=SDL_LoadBMP(“bg.bmp”);
target.x=0;
target.y=0;
target.w=image->w;
target.h=image->h;
SDL_BlitSurface(image,NULL,SDL_GetVideoSurface(),&ziel);
SDL_UpdateRects(SDL_GetVideoSurface(),1,&ziel);

the flags vor SDL_SetVideoMode are: SDL_OPENGL | SDL_SWSURFACE

G++ compiles it with no problems but while its running this nice message
occures:
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
Without the loading the image no error occures.
I hope you can help me.
Scar–
[IMG]

krampenschiesser at freenet.de wrote:

Hi,
I try to make an opengl window. I took that one from the docu.
I only added the following code at line 373 before the while(1):

SDL_Surface *image;
SDL_Rect target;
image=SDL_LoadBMP(“bg.bmp”);
target.x=0;
target.y=0;
target.w=image->w;
target.h=image->h;
SDL_BlitSurface(image,NULL,SDL_GetVideoSurface(),&ziel);
SDL_UpdateRects(SDL_GetVideoSurface(),1,&ziel);

the flags vor SDL_SetVideoMode are: SDL_OPENGL | SDL_SWSURFACE

G++ compiles it with no problems but while its running this nice
message occures:
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
Without the loading the image no error occures.
I hope you can help me.

You can’t use the standard blitting/updaterects routines on an
SDL_OPENGL surface.
If you initialize OpenGL, you’re supposed to subsequently draw using
OpenGL primitives (gl* calls).

Stephane