SDL Fullscreen Problems

Hi,
I’m running the an SDL tutorial from a
href="http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut2
and have run into a bit of a snag. When I attempt to pass
SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN
to SDL_InitVideo I get a blank screen, However, double buffering with
hardware works, and software with fullscreen works, but I can’t seem to
get the three I’d like running up. Should there be other code
modifications to the tutorial aside from the flag changes or am I missing
something else entirely? Could this be a video card issue (mine is pretty
new)?Cheers.

Also, I’ve attempted passing the bit depth as 0 to the SetVideoMode as was
recommended to me, to no avail.

if sdl_swsurface | sdl_doublebuf | sdl_fullscreen works you should use that.
usually your code should work.

you could check the return value of sdl_setvideomode.
or query for the mode information after it’s set to find out what you
really got.

if you have a directx compatible graphics card there should be no
problem with it afaik.

join at krakendev.com wrote:>Hi,

I’m running the an SDL tutorial from a
href="http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut2
and have run into a bit of a snag. When I attempt to pass
SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN
to SDL_InitVideo I get a blank screen, However, double buffering with
hardware works, and software with fullscreen works, but I can’t seem to
get the three I’d like running up. Should there be other code
modifications to the tutorial aside from the flag changes or am I missing
something else entirely? Could this be a video card issue (mine is pretty
new)?Cheers.

Also, I’ve attempted passing the bit depth as 0 to the SetVideoMode as was
recommended to me, to no avail.


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

Well, I can get SWSURFACE and FULLSCREEN working, but when I add
FULLSCREEN I just get black. I’m not really sure what’s up. Cheers.> ----- Original Message -----

From: fhufsky@phorus.at (Florian Hufsky)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Sunday, June 06, 2004 1:07 PM
Subject: Re: [SDL] SDL Fullscreen Problems

if sdl_swsurface | sdl_doublebuf | sdl_fullscreen works you should use
that.
usually your code should work.

you could check the return value of sdl_setvideomode.
or query for the mode information after it’s set to find out what you
really got.

if you have a directx compatible graphics card there should be no
problem with it afaik.

@join_at_krakendev.co wrote:

Hi,
I’m running the an SDL tutorial from a
href="http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut2
and have run into a bit of a snag. When I attempt to pass
SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN
to SDL_InitVideo I get a blank screen, However, double buffering with
hardware works, and software with fullscreen works, but I can’t seem to
get the three I’d like running up. Should there be other code
modifications to the tutorial aside from the flag changes or am I missing
something else entirely? Could this be a video card issue (mine is pretty
new)?Cheers.

Also, I’ve attempted passing the bit depth as 0 to the SetVideoMode as was
recommended to me, to no avail.


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


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

Erg, sorry. Correction:

Well, I can get SWSURFACE and FULLSCREEN working, but when I add DOUBLEBUF
I just get black. I’m not really sure what’s up. Cheers.

— join at krakendev.com wrote:

Erg, sorry. Correction:

Well, I can get SWSURFACE and FULLSCREEN working, but when I
add DOUBLEBUF
I just get black. I’m not really sure what’s up. Cheers.

If doublebuffering is enabled, you need to flip surfaces,
instead of updating.__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.

Yeah. My current Draw function is as follows:

void BSDL::DrawScene()
{
Slock(screen);
ClearScreen();
DrawRotated((int)angle,1);
SDL_Flip(screen);
Sulock(screen);
}

DrawRotated just uses BlitSurface.

The other pertinent functions are:

void BSDL::Slock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
if ( SDL_LockSurface(screen) < 0 )
{
return;
}
}
}

void BSDL::Sulock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
SDL_UnlockSurface(screen);
}
}

I’m just going by the tutorial’s example, but that seems correct (though
obviously I’m making a mistake somewhere). Cheers.> ----- Original Message -----

From: ninmonkeys@yahoo.com (jake b)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Sunday, June 06, 2004 5:02 PM
Subject: Re: [SDL] SDL Fullscreen Problems

@join_at_krakendev.co wrote:

Erg, sorry. Correction:

Well, I can get SWSURFACE and FULLSCREEN working, but when I
add DOUBLEBUF
I just get black. I’m not really sure what’s up. Cheers.

If doublebuffering is enabled, you need to flip surfaces,
instead of updating.

I just noticed you unlock your surface after flipping. The doc
project says to not call SDL_UpdateRect() if the surface is
locked, and i’m guessing the same applies to flipping. Does
unlocking before flipping fix the problem?

**If ClearScreen() calls SDL_FillRect, the surface doesn’t have
to be locked at that point.

If unlocking didn’t work;

a)Are you getting a valid video surface?

b)does DrawRotated() work when doublebuffering is not enabled?

//code to initialize SDL, set a video mode, and check if it
worked

if(SDL_Init(SDL_INIT_VIDEO) < 0) {
cerr << "Couldn’t initialize sdl: " << SDL_GetError() <<
endl;
SDL_Quit();
return -1;
}
screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, screen_bpp,
SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF);
if(screen == NULL)
{
cerr << "Couldn’t set " << SCREEN_W << “x” << SCREEN_H <<
“x” << screen_bpp
<< " video mode " << endl << SDL_GetError() << endl;
//could try at a lower setting, or quit
SDL_Quit();
return -1;
}

//enter game/render loop

SDL_Quit();

— join at krakendev.com wrote:> Yeah. My current Draw function is as follows:

void BSDL::DrawScene()
{
Slock(screen);
ClearScreen();
DrawRotated((int)angle,1);
SDL_Flip(screen);
Sulock(screen);
}

DrawRotated just uses BlitSurface.

The other pertinent functions are:

void BSDL::Slock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
if ( SDL_LockSurface(screen) < 0 )
{
return;
}
}
}

void BSDL::Sulock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
SDL_UnlockSurface(screen);
}
}

I’m just going by the tutorial’s example, but that seems
correct (though
obviously I’m making a mistake somewhere). Cheers.

----- Original Message -----
From: “jake b” <@jake_b>
To: "A list for developers using the SDL library. (includes
SDL-announce)"

Sent: Sunday, June 06, 2004 5:02 PM
Subject: Re: [SDL] SDL Fullscreen Problems

— join at krakendev.com wrote:

Erg, sorry. Correction:

Well, I can get SWSURFACE and FULLSCREEN working, but when
I

add DOUBLEBUF
I just get black. I’m not really sure what’s up. Cheers.

If doublebuffering is enabled, you need to flip surfaces,
instead of updating.


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


Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.

having your surface locked while flipping seems somewhat evil to me.

join at krakendev.com wrote:>Yeah. My current Draw function is as follows:

void BSDL::DrawScene()
{
Slock(screen);
ClearScreen();
DrawRotated((int)angle,1);
SDL_Flip(screen);
Sulock(screen);
}

DrawRotated just uses BlitSurface.

The other pertinent functions are:

void BSDL::Slock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
if ( SDL_LockSurface(screen) < 0 )
{
return;
}
}
}

void BSDL::Sulock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
SDL_UnlockSurface(screen);
}
}

I’m just going by the tutorial’s example, but that seems correct (though
obviously I’m making a mistake somewhere). Cheers.

----- Original Message -----
From: “jake b”
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Sunday, June 06, 2004 5:02 PM
Subject: Re: [SDL] SDL Fullscreen Problems

— join at krakendev.com wrote:

Erg, sorry. Correction:

Well, I can get SWSURFACE and FULLSCREEN working, but when I
add DOUBLEBUF
I just get black. I’m not really sure what’s up. Cheers.

If doublebuffering is enabled, you need to flip surfaces,
instead of updating.


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