Will forking fork things up?

Good evening all,

I’m interested in forking a sub process from my SDL/framebuffer menu
front end.
Will the two processes play nicely and share frame buffer or will I have
to go to a lot of effort to get that to work?
Anyone have any idea?

will not work out of the box - cannot share frame buffer just like
that. you have to communicate in a nice way from the “subprocess” to
the “main process” whichever has the frame buffer allocated by
SDL_SetVideoModeOn 5/21/05, Uzik wrote:

Good evening all,

I’m interested in forking a sub process from my SDL/framebuffer menu
front end.
Will the two processes play nicely and share frame buffer or will I have
to go to a lot of effort to get that to work?
Anyone have any idea?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Olof Bjarnason wrote:

will not work out of the box - cannot share frame buffer just like
that. you have to communicate in a nice way from the “subprocess” to
the “main process” whichever has the frame buffer allocated by
SDL_SetVideoMode

Since the other process isn’t something I wrote I will probably have to
use SDL_Quit() to close the video before forking.
Thanks for helping out.

Hello all,

I know this is predominantly a C/C++ list but I’m having a few problems
with SDL using the JEDI-SDL pascal interface. A very basic breakdown of
my code is as follows:-

var
mainScreen : PSDL_Surface // (C: SDL_Surface *mainScreen)
alphaImage : PSDL_Surface

begin
// SDL initialisation cut for ease of reading…

mainScreen := SDL_SetVideoMode( 640, 480, 16, SDL_HWSURFACE or
SDL_DOUBLEBUF or SDL_FULLSCREEN );
alphaImage := SDL_LoadBMP( ‘foo.bmp’ );
SDL_FillRect( mainScreen, Nil, $FF00FF ); // Nice pink(ish) background.
SDL_Flip( mainScreen );

// Problem line?
SDL_SetColorKey( alphaImage, SDL_SRCCOLORKEY, SDL_MapRGB(
alphaImage.format, 255,255,255 ) );
// End of problem line?

SDL_BlitSurface( alphaImage, Nil, mainScreen, Nil );
SDL_Flip( mainScreen );

// code waiting for keypress then exit cut for ease of reading…
end.

The above code works OK if I remove the ( or SDL_FULLSCREEN ) but
otherwise the screen remains black until it detects an input, then
flashes pink and the program ends. If i remove the code commented as
"Problem Line?" then the screen does show the black and white bitmap in
the top-left (128x128 pixels) but the rest of the background remains
black. Removing the alphaImage and blit completely and the screen turns
a ghastly shade of pink as i expect it to.

As stated, this only happens in Full Screen, when windowed it works as I
expect it to.

I’m fairly new to graphical programming and therefore my knowledge is
somewhat limited but can anyone shed any light on what I am overlooking
in my code please?

Thank you in advance,
Martyn

Martyn Ashworth wrote:

Hello all,

I know this is predominantly a C/C++ list but I’m having a few
problems with SDL using the JEDI-SDL pascal interface. A very basic
breakdown of my code is as follows:-

var
mainScreen : PSDL_Surface // (C: SDL_Surface *mainScreen)
alphaImage : PSDL_Surface

begin
// SDL initialisation cut for ease of reading…

mainScreen := SDL_SetVideoMode( 640, 480, 16, SDL_HWSURFACE or
SDL_DOUBLEBUF or SDL_FULLSCREEN );
alphaImage := SDL_LoadBMP( ‘foo.bmp’ );
SDL_FillRect( mainScreen, Nil, $FF00FF ); // Nice pink(ish) background.
SDL_Flip( mainScreen );

// Problem line?
SDL_SetColorKey( alphaImage, SDL_SRCCOLORKEY, SDL_MapRGB(
alphaImage.format, 255,255,255 ) ); // End of problem line?

SDL_BlitSurface( alphaImage, Nil, mainScreen, Nil );
SDL_Flip( mainScreen );

// code waiting for keypress then exit cut for ease of reading…
end.

The above code works OK if I remove the ( or SDL_FULLSCREEN ) but
otherwise the screen remains black until it detects an input, then
flashes pink and the program ends. If i remove the code commented as
"Problem Line?" then the screen does show the black and white bitmap
in the top-left (128x128 pixels) but the rest of the background
remains black. Removing the alphaImage and blit completely and the
screen turns a ghastly shade of pink as i expect it to.

As stated, this only happens in Full Screen, when windowed it works as
I expect it to.

I’m fairly new to graphical programming and therefore my knowledge is
somewhat limited but can anyone shed any light on what I am
overlooking in my code please?

Some of the options on the video mode call only work in fullscreen or
windowed mode.
I think double buffering is one of those. Try commenting out the flip in
full screen mode.