Library initialization

Hi, I have a question regarding the library initialization.

SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO)

This initialize the SDL video and the SDL AUDIO. Okie.

But what if this fails ? How do I know if there is something
wrong with video or audio ?

I mean, is it possible to do somthing like:

if (SDL_Init (SDL_INIT_VIDEO) < 0)
{
/* couldn’t initialize, we exit … */
exit(1);
}

/* Video initialized, so we try to initialize sound /
/
I don’t know if this could be done. /
/
so is it possible to call SDL_Init more than once ? */

if (SDL_Init (SDL_INIT_AUDIO) < 0)
{
/* Audio doesn’t work, so we go on with out audio. */
audio_flag = DISABLE_AUDIO;
}

Is that ok ? or should I always do:
if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0)
{
/* error ok, but what failed ? */
}

Ops, ehm another question :wink:

Why if the video is initialized in a 8bpp mode but the current
X Windows session is in 16bpp mode, the SDL program works in 16bpp
even if it has been initialized in 8bpp ? Shouldn’t it give
errors or loading images with a screwed palette ?

Also if I try to run testgl under test directory i get:

Couldn’t set GL mode: X11 driver not configured with OpenGL

I use Linux, X ver 3.3.6 using the SVGA driver

and I’ve Mesa3d library correctly installed.

What’s wrong ?

Thanks.–

  • @G.Gabriele ---------------+
    | |
    ±----------------- think Open Source -+