Yet another primitive 3d game engine

Hi.

I have the beginings of (yeesh, yet another) simple Linux 3D
game engine that is SDL-based. It uses OpenGL in a dynamically
loaded renderer. I plan to use OpenAL in the same manner for
sound. It uses libxml2 to read data.

So I offer yet another sample of using SDL and OpenGL for
anyone that might want to see that. But more likely, I’d like
to here about the things I’m doing all wrong.

It is called VU and it is at http://www.backstep.org

Sorry for the vaguely SDL, vaguely on-topic post.–
Douglas Jerome <@Douglas_Jerome>
http://www.globalcrossing.net/~jerome

Douglas Jerome wrote:

Hi.

I have the beginings of (yeesh, yet another) simple Linux 3D
game engine that is SDL-based. It uses OpenGL in a dynamically
loaded renderer. I plan to use OpenAL in the same manner for
sound. It uses libxml2 to read data.

So I offer yet another sample of using SDL and OpenGL for
anyone that might want to see that. But more likely, I’d like
to here about the things I’m doing all wrong.

It is called VU and it is at http://www.backstep.org

Sorry for the vaguely SDL, vaguely on-topic post.

I have some feed back on this.
I have this sequence of code:

vidinfo = SDL_GetVideoInfo();
if (vidinfo == NULL)
   {
   (void)fprintf (
                 stderr,
                 "Can't query SDL video for %s: %s.\n",
                 a_client, SDL_GetError()
                 );
   return NULL;
   }

bpp  = vidinfo->vfmt->BitsPerPixel;
nbpp = SDL_VideoModeOK (x, y, bpp, a_flags);

if (nbpp == 0)
   {
   (void)fprintf (
                 stderr,
                 "Can't set SDL video mode for %s [%dx%dx%d]: %s.\n",
                 a_client, a_screenX, a_screenY, bpp, SDL_GetError()
                 );
   return NULL;
   }

And someone is getting nbpp == 0 and this message:

Can’t set SDL video mode for Splash Screen [640x480x32]: Couldn’t find
matching GLX visual.

What is the best way to manage this problem? Try several times with a
decreasing bpp?–
Douglas Jerome <@Douglas_Jerome>
http://www.backstep.org
http://www.globalcrossing.net/~jerome

Douglas Jerome wrote:

Hi.

I have the beginings of (yeesh, yet another) simple Linux 3D
game engine that is SDL-based. It uses OpenGL in a dynamically
loaded renderer. I plan to use OpenAL in the same manner for
sound. It uses libxml2 to read data.

So I offer yet another sample of using SDL and OpenGL for
anyone that might want to see that. But more likely, I’d like
to here about the things I’m doing all wrong.

It is called VU and it is at http://www.backstep.org

Sorry for the vaguely SDL, vaguely on-topic post.

I have some feed back on this.
I have this sequence of code:

vidinfo = SDL_GetVideoInfo();
if (vidinfo == NULL)
   {
   (void)fprintf (
                 stderr,
                 "Can't query SDL video for %s: %s.\n",
                 a_client, SDL_GetError()
                 );
   return NULL;
   }

bpp  = vidinfo->vfmt->BitsPerPixel;
nbpp = SDL_VideoModeOK (x, y, bpp, a_flags);

if (nbpp == 0)
   {
   (void)fprintf (
                 stderr,
                 "Can't set SDL video mode for %s [%dx%dx%d]: %s.\n",
                 a_client, a_screenX, a_screenY, bpp, SDL_GetError()
                 );
   return NULL;
   }

And someone is getting nbpp == 0 and this message:

Can’t set SDL video mode for Splash Screen [640x480x32]: Couldn’t find
matching GLX visual.

This is a puzzle, isn’t it? The problem I see is that the error message
doesn’t print the values that are passed to SDL_VideoModeOK() so we, the
readers, can’t know for sure what parameters are actually causing the
error. :slight_smile: For example, you pass x, but print out screenX. I would
verify the values of the variables you are passing to SDL_VideoModeOK().

I would take a close look at the value of a_flags because that is the
only value you haven’t listed here. And, it could be what is messing you
up.

	Bob PendletonOn Sun, 2003-11-23 at 20:29, Douglas Jerome wrote:

What is the best way to manage this problem? Try several times with a
decreasing bpp?

±--------------------------------------+

Bob Pendleton wrote:

Douglas Jerome wrote:

Hi.

[snip]

I have this sequence of code:

vidinfo = SDL_GetVideoInfo();
if (vidinfo == NULL)
{
(void)fprintf (
stderr,
“Can’t query SDL video for %s: %s.\n”,
a_client, SDL_GetError()
);
return NULL;
}

bpp = vidinfo->vfmt->BitsPerPixel;
nbpp = SDL_VideoModeOK (x, y, bpp, a_flags);

if (nbpp == 0)
{
(void)fprintf (
stderr,
“Can’t set SDL video mode for %s [%dx%dx%d]: %s.\n”,
a_client, a_screenX, a_screenY, bpp, SDL_GetError()
);
return NULL;
}

And someone is getting nbpp == 0 and this message:
Actually, nbpp == 32. I blew it here.

Can’t set SDL video mode for Splash Screen [640x480x32]: Couldn’t find
matching GLX visual.

This is a puzzle, isn’t it? The problem I see is that the error message
doesn’t print the values that are passed to SDL_VideoModeOK() so we, the
readers, can’t know for sure what parameters are actually causing the
error. :slight_smile: For example, you pass x, but print out screenX. I would
verify the values of the variables you are passing to SDL_VideoModeOK().

I would take a close look at the value of a_flags because that is the
only value you haven’t listed here. And, it could be what is messing you
up.
Bob Pendleton

What is the best way to manage this problem? Try several times with a
decreasing bpp?

I was on #sdl last night, and with some guys that know what
they are doing, I discovered the problem.

The X11 server was running 32 bpp, but the only GLX visuals
were 24 bpp. SDL_VideoModeOK() was returning 32, even when I
passed 24 to it (for bpp). Since the flags to SDL_VideoModeOK()
were SDL_OPENGL, I would’ve thought that it would return
only GLX visuals that work, but it doesn’t. I don’t know the SDL
version; it wasn’t my machine and I didn’t check. This is
on a recent SuSE Linux, btw. And with proprietary nVidia drivers,
maybe the problem is there, I dunno. I may investigate SDL_VideoModeOK()
because I don’t want to use glx functions directly. I presume that
some machines can properly have 32 returned from SDL_VideoModeOK() and
then used in SDL_SetVideoMode() which was returning NULL.

Thanks for the help though Bob, and the guys on #sdl.> On Sun, 2003-11-23 at 20:29, Douglas Jerome wrote:


Douglas Jerome <@Douglas_Jerome>
http://www.backstep.org
http://www.globalcrossing.net/~jerome