Can somebody tell me why this function right here might seg fault:
int PD_CreateDoubleBuffer()
{
Uint32 rmask, gmask, bmask, amask;
/* Make sure the Screen is allocated */
if ( Screen == NULL )
return -1;
/* Setup up our screen format variables */
rmask = Screen->format->Rmask;
gmask = Screen->format->Gmask;
bmask = Screen->format->Bmask;
amask = Screen->format->Amask;
DoubleBuffer = SDL_AllocSurface (SDL_HWSURFACE, SCREENWIDTH,
SCREENHEIGHT, BPP, rmask, gmask, bmask, amask);
if ( DoubleBuffer == NULL ) {
fprintf(stderr, “Couldn’t create %dx%dx%d DoubleBuffer: %s\n”,
SCREENWIDTH, SCREENHEIGHT, BPP, SDL_GetError());
exit(1);
SDL_MapSurface(DoubleBuffer, Screen->format);
}
return;
}
The only thing I can figure is that it has something to do with the RGB
and A masks, but I don’t know exactly what they do. I mean I want my
double buffer to be just like my screen right? DoubleBuffer and Screen
are both SDL_Surfaces of course. SCREENWIDTH, SCREENHEIGHT and BPP are
self explanatory and set up right as global variables.
Dude, isn’t SDL_MapSurface obsolete?
Paul Lowe wrote:
Dude, isn’t SDL_MapSurface obsolete?
Is it? I didn’t know. All I know is what I’ve read on the web page
documentation.
Anyhow obsolete or not, SDL_MapSurface isn’t causing my seg fault.
Try using SDL 0.9.13, which doesn’t need SDL_MapSurface()
Can somebody tell me why this function right here might seg fault:
int PD_CreateDoubleBuffer()
{
Uint32 rmask, gmask, bmask, amask;
/* Make sure the Screen is allocated */
if ( Screen == NULL )
return -1;
/* Setup up our screen format variables */
rmask = Screen->format->Rmask;
gmask = Screen->format->Gmask;
bmask = Screen->format->Bmask;
amask = Screen->format->Amask;
DoubleBuffer = SDL_AllocSurface (SDL_HWSURFACE, SCREENWIDTH,
SCREENHEIGHT, BPP, rmask, gmask, bmask, amask);
if ( DoubleBuffer == NULL ) {
fprintf(stderr, “Couldn’t create %dx%dx%d DoubleBuffer: %s\n”,
SCREENWIDTH, SCREENHEIGHT, BPP, SDL_GetError());
exit(1);
SDL_MapSurface(DoubleBuffer, Screen->format);
}
return;
}
The only thing I can figure is that it has something to do with the RGB
and A masks, but I don’t know exactly what they do. I mean I want my
double buffer to be just like my screen right? DoubleBuffer and Screen
are both SDL_Surfaces of course. SCREENWIDTH, SCREENHEIGHT and BPP are
self explanatory and set up right as global variables.
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec
Well, even though commenting out the SDL_MapSurface didn’t stop the
crashing, updated to the development version did.
Thanks again!
Sam Lantinga wrote:> Try using SDL 0.9.13, which doesn’t need SDL_MapSurface()
Can somebody tell me why this function right here might seg fault:
int PD_CreateDoubleBuffer()
{
Uint32 rmask, gmask, bmask, amask;
/* Make sure the Screen is allocated */
if ( Screen == NULL )
return -1;
/* Setup up our screen format variables */
rmask = Screen->format->Rmask;
gmask = Screen->format->Gmask;
bmask = Screen->format->Bmask;
amask = Screen->format->Amask;
DoubleBuffer = SDL_AllocSurface (SDL_HWSURFACE, SCREENWIDTH,
SCREENHEIGHT, BPP, rmask, gmask, bmask, amask);
if ( DoubleBuffer == NULL ) {
fprintf(stderr, “Couldn’t create %dx%dx%d DoubleBuffer: %s\n”,
SCREENWIDTH, SCREENHEIGHT, BPP, SDL_GetError());
exit(1);
SDL_MapSurface(DoubleBuffer, Screen->format);
}
return;
}
The only thing I can figure is that it has something to do with the RGB
and A masks, but I don’t know exactly what they do. I mean I want my
double buffer to be just like my screen right? DoubleBuffer and Screen
are both SDL_Surfaces of course. SCREENWIDTH, SCREENHEIGHT and BPP are
self explanatory and set up right as global variables.
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec