Fedora Core 3, SDL, and OpenGL: runtime problem

I’m running a stock Fedora Core 3 (“FC3”) – just installed it. I wrote a
little windowed SDL application (“sdl_gl_test”) that uses OpenGL. It builds
fine, but when I run it, it crashes telling me:

$ ./sdl_gl_test
Found bpp = 32
*** Didn’t find hw_available. Setting vid_flags |= SDL_SWSURFACE.
*** Didn’t find blit_hw. Not setting vid_flags with SDL_HWACCEL.
libGL warning: 3D driver claims to not support visual 0x23
libGL warning: 3D driver claims to not support visual 0x24
libGL warning: 3D driver claims to not support visual 0x27
libGL warning: 3D driver claims to not support visual 0x28
libGL warning: 3D driver claims to not support visual 0x2b
libGL warning: 3D driver claims to not support visual 0x2c
libGL warning: 3D driver claims to not support visual 0x2f
libGL warning: 3D driver claims to not support visual 0x30
Unable to set video mode. SDL error: “Couldn’t find matching GLX visual”.
Quitting.

(Note that the first 3 lines and the last line are my attempt at printf-style
debugging.) I’m guessing those libGL warnings are related to it crashing since
the same app works for me on Mac OS X.

My x86 box contains a Matrox G400, and glxinfo is telling me:

$ glxinfo
name of display: :0.0
libGL warning: 3D driver claims to not support visual 0x23
libGL warning: 3D driver claims to not support visual 0x24
libGL warning: 3D driver claims to not support visual 0x27
libGL warning: 3D driver claims to not support visual 0x28
libGL warning: 3D driver claims to not support visual 0x2b
libGL warning: 3D driver claims to not support visual 0x2c
libGL warning: 3D driver claims to not support visual 0x2f
libGL warning: 3D driver claims to not support visual 0x30
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
GLX_ARB_multisample, GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_EXT_import_context, GLX_OML_swap_method, GLX_SGI_make_current_read,
GLX_SGIS_multisample, GLX_SGIX_fbconfig
client glx vendor string: SGI
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_allocate_memory,
GLX_MESA_swap_control, GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
GLX_OML_sync_control, GLX_SGI_make_current_read, GLX_SGI_swap_control,
GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group
GLX extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_swap_control,
GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_SGI_make_current_read,
GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig
OpenGL vendor string: VA Linux Systems Inc.
OpenGL renderer string: Mesa DRI G400 20030328 AGP 1x x86/MMX+/3DNow!+
OpenGL version string: 1.2 Mesa 6.1
OpenGL extensions:
GL_ARB_multisample, GL_ARB_multitexture, GL_ARB_texture_compression,
GL_ARB_texture_env_add, GL_ARB_texture_env_combine,
GL_ARB_texture_env_crossbar, GL_ARB_transpose_matrix, GL_ARB_window_pos,
GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_logic_op, GL_EXT_clip_volume_hint,
GL_EXT_compiled_vertex_array, GL_EXT_copy_texture,
GL_EXT_draw_range_elements, GL_EXT_fog_coord, GL_EXT_packed_pixels,
GL_EXT_polygon_offset, GL_EXT_rescale_normal, GL_EXT_secondary_color,
GL_EXT_separate_specular_color, GL_EXT_stencil_wrap, GL_EXT_subtexture,
GL_EXT_texture, GL_EXT_texture3D, GL_EXT_texture_edge_clamp,
GL_EXT_texture_env_add, GL_EXT_texture_env_combine, GL_EXT_texture_object,
GL_EXT_texture_rectangle, GL_EXT_vertex_array, GL_APPLE_packed_pixels,
GL_ATI_texture_env_combine3, GL_IBM_rasterpos_clip, GL_MESA_ycbcr_texture,
GL_MESA_window_pos, GL_NV_light_max_exponent, GL_NV_texture_rectangle,
GL_NV_texgen_reflection, GL_SGIS_generate_mipmap,
GL_SGIS_texture_edge_clamp, GL_SGIS_texture_lod
glu version: 1.3
glu extensions:
GLU_EXT_nurbs_tessellator, GLU_EXT_object_space_tess

visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat----------------------------------------------------------------------
0x23 24 tc 0 24 0 r y . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x24 24 tc 0 24 0 r . . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x25 24 tc 0 24 0 r y . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x26 24 tc 0 24 0 r . . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x27 24 tc 0 24 0 r y . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x28 24 tc 0 24 0 r . . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x29 24 tc 0 24 0 r y . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow
0x2a 24 tc 0 24 0 r . . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow
0x2b 24 dc 0 24 0 r y . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x2c 24 dc 0 24 0 r . . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x2d 24 dc 0 24 0 r y . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x2e 24 dc 0 24 0 r . . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x2f 24 dc 0 24 0 r y . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x30 24 dc 0 24 0 r . . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x31 24 dc 0 24 0 r y . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow
0x32 24 dc 0 24 0 r . . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow

and glxgears runs fine (though gives those same libGL warning messages).

I can post the code if helpful here, but it’s pretty textbook-style stuff.

Is anyone else having trouble with the FC3, SDL, & OpenGL combo?


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Can’t help with your problem, but I’ll tackle those flags instead.

A surface can practically be one of three types. 1) HWSURFACE 2)
SWSURFACE 3) OPENGL. That’s because when you set OPENGL those other two
don’t have a meaning.

You don’t have to check beforehand what is available. You can just
request a HWSURFACE. You’ll get an SWSURFACE back if it’s not available.

And RTFM about SDL_SetVideoMode. Especially the flags you can give it.
SDL_HWACCEL is not among those. Check what it means, and where exactly
you can encounter it.On Tue, 2004-11-23 at 19:35, John M. Gabriele wrote:

I’m running a stock Fedora Core 3 (“FC3”) – just installed it. I wrote a
little windowed SDL application (“sdl_gl_test”) that uses OpenGL. It builds
fine, but when I run it, it crashes telling me:

$ ./sdl_gl_test
Found bpp = 32
*** Didn’t find hw_available. Setting vid_flags |= SDL_SWSURFACE.
*** Didn’t find blit_hw. Not setting vid_flags with SDL_HWACCEL.


Petri Latvala

John M. Gabriele wrote:

I’m running a stock Fedora Core 3 (“FC3”) – just installed it. I wrote a
little windowed SDL application (“sdl_gl_test”) that uses OpenGL. It builds
fine, but when I run it, it crashes telling me:

$ ./sdl_gl_test
Found bpp = 32
*** Didn’t find hw_available. Setting vid_flags |= SDL_SWSURFACE.
*** Didn’t find blit_hw. Not setting vid_flags with SDL_HWACCEL.
libGL warning: 3D driver claims to not support visual 0x23
libGL warning: 3D driver claims to not support visual 0x24
libGL warning: 3D driver claims to not support visual 0x27
libGL warning: 3D driver claims to not support visual 0x28
libGL warning: 3D driver claims to not support visual 0x2b
libGL warning: 3D driver claims to not support visual 0x2c
libGL warning: 3D driver claims to not support visual 0x2f
libGL warning: 3D driver claims to not support visual 0x30
Unable to set video mode. SDL error: “Couldn’t find matching GLX visual”.
Quitting.

What visual properties are you requesting ? Can you show us your code ?
This is usually the result of asking for an unsupported visual feature
combination.

Stephane

— Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

John M. Gabriele wrote:

I’m running a stock Fedora Core 3 (“FC3”) – just installed it. I wrote a
little windowed SDL application (“sdl_gl_test”) that uses OpenGL. It builds
fine, but when I run it, it crashes telling me:

$ ./sdl_gl_test
Found bpp = 32
*** Didn’t find hw_available. Setting vid_flags |= SDL_SWSURFACE.
*** Didn’t find blit_hw. Not setting vid_flags with SDL_HWACCEL.
libGL warning: 3D driver claims to not support visual 0x23
libGL warning: 3D driver claims to not support visual 0x24
libGL warning: 3D driver claims to not support visual 0x27
libGL warning: 3D driver claims to not support visual 0x28
libGL warning: 3D driver claims to not support visual 0x2b
libGL warning: 3D driver claims to not support visual 0x2c
libGL warning: 3D driver claims to not support visual 0x2f
libGL warning: 3D driver claims to not support visual 0x30
Unable to set video mode. SDL error: “Couldn’t find matching GLX visual”.
Quitting.

What visual properties are you requesting ? Can you show us your code ?
This is usually the result of asking for an unsupported visual feature
combination.

Stephane

Thanks for the replies Petri and Stephane.

I’ve made some changes (as best I understand ATM) that Petri
recommended and have placed my code here:
http://users.bestweb.net/~john3g/temp/sdl_gl_test.tar.bz2
(makefile and very small readme.txt are also included)

I still get that pesky ‘Unable to set video mode. SDL error:
“Couldn’t find matching GLX visual”. Quitting.’ error though.

Any help and/or comments are appreciated.

—J__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com

John M. Gabriele wrote:

Thanks for the replies Petri and Stephane.

I’ve made some changes (as best I understand ATM) that Petri
recommended and have placed my code here:
http://users.bestweb.net/~john3g/temp/sdl_gl_test.tar.bz2
(makefile and very small readme.txt are also included)

I still get that pesky ‘Unable to set video mode. SDL error:
“Couldn’t find matching GLX visual”. Quitting.’ error though.

Any help and/or comments are appreciated.

Ok, look at this line :

SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE,   8 );

and then look at the list of available visuals from your glxinfo output
(keep in mind this output is platform and card dependent) :

visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat----------------------------------------------------------------------
0x23 24 tc 0 24 0 r y . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x24 24 tc 0 24 0 r . . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x25 24 tc 0 24 0 r y . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x26 24 tc 0 24 0 r . . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x27 24 tc 0 24 0 r y . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x28 24 tc 0 24 0 r . . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x29 24 tc 0 24 0 r y . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow
0x2a 24 tc 0 24 0 r . . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow
0x2b 24 dc 0 24 0 r y . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x2c 24 dc 0 24 0 r . . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
0x2d 24 dc 0 24 0 r y . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x2e 24 dc 0 24 0 r . . 8 8 8 0 0 24 8 0 0 0 0 0 0 None
0x2f 24 dc 0 24 0 r y . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x30 24 dc 0 24 0 r . . 8 8 8 0 0 0 0 16 16 16 0 0 0 Slow
0x31 24 dc 0 24 0 r y . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow
0x32 24 dc 0 24 0 r . . 8 8 8 0 0 24 8 16 16 16 0 0 0 Slow

You don’t have a single visuals that has alpha bits. So you can’t
request alpha bits or it will fail, so keep SDL_GL_ALPHA_SIZE at 0.
That’s what I meant by “visual attributes” : the number of r, g, b,
alpha or whatever bits.

And please remove that SDL_HWACCEL flag from vid_flags. It is useless in
SDL_SetVideoMode, and it is read-only on surfaces. It won’t buy you any
performance, it’s not an undocumented l33t trick, it just spreads
misconceptions about how SDL works.
Also, SDL_HWPALETTE and SDL_DOUBLEBUF are useless together with an
OpenGL context.

Stephane

— Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

[snip]

Ok, look at this line :

SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE,   8 );

and then look at the list of available visuals from your glxinfo output
(keep in mind this output is platform and card dependent) :

[snip]

You don’t have a single visuals that has alpha bits. So you can’t
request alpha bits or it will fail, so keep SDL_GL_ALPHA_SIZE at 0.

That was it Stephane! Thanks!

That’s what I meant by “visual attributes” : the number of r, g, b,
alpha or whatever bits.

And please remove that SDL_HWACCEL flag from vid_flags. It is useless in
SDL_SetVideoMode, and it is read-only on surfaces. It won’t buy you any
performance, it’s not an undocumented l33t trick, it just spreads
misconceptions about how SDL works.
Also, SDL_HWPALETTE and SDL_DOUBLEBUF are useless together with an
OpenGL context.

Stephane

I made the changes and put the code up on my little
site (different location than before) for anyone getting
started with SDL & OpenGL (in procedural C++).

http://users.bestweb.net/~john3g/sdl_gl_test.tar.bz2

—J__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail

I would like to add that having alpha in the framebuffer is seldom
needed. You can still do blending without it. The framebuffer alpha is
just 0 always. The usual blending operation is GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, which uses only the fragment’s alpha. Another
common one is GL_SRC_ALPHA, GL_ONE which is often used to avoid having
to sort objects back-to-front. It doesn’t use the framebuffer alpha
either.On Wed, 2004-11-24 at 03:53, John M. Gabriele wrote:

— Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

[snip]

Ok, look at this line :

SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE,   8 );

and then look at the list of available visuals from your glxinfo output
(keep in mind this output is platform and card dependent) :

[snip]

You don’t have a single visuals that has alpha bits. So you can’t
request alpha bits or it will fail, so keep SDL_GL_ALPHA_SIZE at 0.

That was it Stephane! Thanks!


Petri Latvala