Dear fellow developpers,
My first post here. First of all, many thanks for the great and vastly
portable SDL library (heck, if OpenAL was as portable as SDL is, I’d
attempt to port the Torque Engine to Solaris/Sparc ).
I am not an SDL developper per se but I try to help/maintain/patch the
Solaris/Sparc port of some OSS projects (quake2, quakeforge, q2f). I’m
running into a problem with the knowledge that SDL had of the ‘best’ depth
on most SUN Sparc graphics hardware.
Very unlike Linux but close to what other workstation vendors are doing,
workstation-class SUN Graphics cards usually provide several bit depths.
In more detail, on most of their high-end cards, you get 1,8 and 24bpp
with 8bpp being the default. Also, the root window will be layed out in
the default overlay plane at 8bpp. SUN video cards that do this are:
Creator2d, Creator3d, SX, XVR-500, Elite3d, Expert3d lite, Expert3d and
XVR-1000. On the other hand, simplier video cards than can only do 8bpp or
24bpp are PGX32, PGX64, TGX and most 6+years Sun video cards.
What this means for SDL apps on the better cards is exhibited by this code
snippet from gltron:
int SystemCreateWindow(char name) {
int f = SDL_OPENGL;
if(fullscreen & SYSTEM_FULLSCREEN)
f |= SDL_FULLSCREEN;
if( (screen = SDL_SetVideoMode( width, height, 0, f )) == NULL ) {
exit(1); / OK: critical, no visual */
}
SDL_WM_SetCaption(“GLtron”, “”);
return 1;
}
The trouble lies in SDL_SetVideoMode where the 0 bit depth will make the
app get the ‘default’ bit depth and hence the app will get the 8bpp
overlay plane from the root window (and look quite ugly, mind you).
From the documentation, the workaround seems to be to use SDL_GetVideoInfo
before SDL_SetVideoMode but I’ m not sure if will work correctly on SUN.
I took a look at src/video/SDL_video.c in SDL-1.2.5 but I was unable to
understand the algorithm used for selecting the ‘best’ bit depth. I’ll do
more testing when I get home tonight to see if SDL_SetVideoMode -does- fix
these default depth problems on Sun.
Does anyone know if this is the portable way to make both the rare 8bit
SUN’s and the 8+24bit SUN’s happy as well as the other SDL-enabled
platforms? (I’d rather not #ifdef sun everything SDL for SUN).
Thanks for reading.
PS: I’m sorry if this has been asked before but since the list archive
doesn’t appear to be searchable, I could not look for previous posts.
Vincent S. Cojot, @Vincent_S_Cojot