Is possible to know the desktop color depth?

Hello friends,

I would like to add a warning message when you are running in window mode and you set a different color depth (in SDL_SetVideoMode()) of the current desktop. This slow down the graphic performance due to each screen dump, the surface must be converted.

The question is… is possible to know the desktop color depth? I know with the new 1.2.10 version is possible to get the desktop size but, what about the color depth?

Thanks you very much!

Roberto

Roberto Prieto wrote:

Hello friends,

I would like to add a warning message when you are running in 

window mode and you set a different color depth (in
SDL_SetVideoMode()) of the current desktop. This slow down the graphic
performance due to each screen dump, the surface must be converted.

The question is… is possible to know the desktop color depth? I
know with the new 1.2.10 version is possible to get the desktop size
but, what about the color depth?
I think you have it backwards. Why don’t you use SDL_DisplayFormat
instead to ensure that all your surfaces have the right format and thys
no conversion happens ?

Stephane

Yes, Im using SDL_DisplayFormat() but I meant the below case:

  • Im running Windows desktop to 32bits
  • In my SDL app I have selected a 16bits in a window mode.
  • Internally, everything in my SDL app is converted to the 16bits… but…
    the final rendering to the window will be done converting to 32bits due to
    that is my color depth on my Windows desktop…

I have tested that on new system this conversion is done very fast… the
problem relies on medium to old system… this conversion will kill the
performance and sometimes, you are not aware of this… for this, I would
like to add this warning message.

Cheers!> ----- Original Message -----

From: stephane.marchesin@wanadoo.fr (Stephane Marchesin)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Monday, June 19, 2006 12:24 AM
Subject: Re: [SDL] Is possible to know the desktop color depth?

Roberto Prieto wrote:

Hello friends,

I would like to add a warning message when you are running in

window mode and you set a different color depth (in
SDL_SetVideoMode()) of the current desktop. This slow down the graphic
performance due to each screen dump, the surface must be converted.

The question is… is possible to know the desktop color depth? I
know with the new 1.2.10 version is possible to get the desktop size
but, what about the color depth?
I think you have it backwards. Why don’t you use SDL_DisplayFormat
instead to ensure that all your surfaces have the right format and thys
no conversion happens ?

Stephane


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

__________ Informaci?n de NOD32, revisi?n 1.1606 (20060617) __________

Este mensaje ha sido analizado con NOD32 antivirus system
http://www.nod32.com

Roberto Prieto wrote:

Yes, Im using SDL_DisplayFormat() but I meant the below case:

  • Im running Windows desktop to 32bits
  • In my SDL app I have selected a 16bits in a window mode.
  • Internally, everything in my SDL app is converted to the 16bits… but…
    the final rendering to the window will be done converting to 32bits due to
    that is my color depth on my Windows desktop…

I have tested that on new system this conversion is done very fast… the
problem relies on medium to old system… this conversion will kill the
performance and sometimes, you are not aware of this… for this, I would
like to add this warning message.

You should pass bpp=0 to SDL_SetVideoMode then.

Stephane

Yes, I know, I use it but… a newbie doesnt have to know it and this is
whatever I want to avoid…

I have seen some code of people that are using SDL (through CRM32Pro) and
dont know this, so I want to add this warning message…

any ideas? if it is not possible, I could modify SDL source code to get it
:slight_smile:

Cheers!> ----- Original Message -----

From: stephane.marchesin@wanadoo.fr (Stephane Marchesin)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Monday, June 19, 2006 1:21 AM
Subject: Re: [SDL] Is possible to know the desktop color depth?

Roberto Prieto wrote:

Yes, Im using SDL_DisplayFormat() but I meant the below case:

  • Im running Windows desktop to 32bits
  • In my SDL app I have selected a 16bits in a window mode.
  • Internally, everything in my SDL app is converted to the 16bits…
    but…
    the final rendering to the window will be done converting to 32bits due
    to
    that is my color depth on my Windows desktop…

I have tested that on new system this conversion is done very fast… the
problem relies on medium to old system… this conversion will kill the
performance and sometimes, you are not aware of this… for this, I would
like to add this warning message.

You should pass bpp=0 to SDL_SetVideoMode then.

Stephane


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

__________ Informaci?n de NOD32, revisi?n 1.1606 (20060617) __________

Este mensaje ha sido analizado con NOD32 antivirus system
http://www.nod32.com

Roberto Prieto wrote:

Yes, I know, I use it but… a newbie doesnt have to know it and this is
whatever I want to avoid…

I have seen some code of people that are using SDL (through CRM32Pro) and
dont know this, so I want to add this warning message…

any ideas? if it is not possible, I could modify SDL source code to get it
:slight_smile:

Use SDL_GetVideoInfo, which will return a struct of type SDL_VideoInfo,
which has a field vfmt which holds the current screen pixel format.

Stephane

Thanks you very much :slight_smile:

I will try it and let you know.

By the way… I know you and David Olfson are the masters of glSDL (maybe I forget someone…,in this case, please excuse me :slight_smile: ), Im planning to use it but I would like to use latest SDL CVS version too.

Do you have merged the latest SDL CVS with glSDL? or your patch to merge it will work with latest SDL CVS?

Cheers!–

Roberto Prieto
MegaStorm Systems ©
http://www.megastormsystems.com

---- Stephane Marchesin <stephane.marchesin at wanadoo.fr> escribi?:

Roberto Prieto wrote:

Yes, I know, I use it but… a newbie doesnt have to know it and this is
whatever I want to avoid…

I have seen some code of people that are using SDL (through CRM32Pro) and
dont know this, so I want to add this warning message…

any ideas? if it is not possible, I could modify SDL source code to get it
:slight_smile:

Use SDL_GetVideoInfo, which will return a struct of type SDL_VideoInfo,
which has a field vfmt which holds the current screen pixel format.

Stephane


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