[SDL] OpenGL in linux

Michael Cowart cutefuzzysquirrel at yahoo.com
Sat Jul 20 15:37:01 PDT 2002


I have the newest nvidia drivers installed, and have
3d hardware acceleration (I've tested it with tuxracer
and Jedi Knight II under WINE, it runs faster than it
does in windows =)

I don't think it's a symlink problem, because I took
the roaddemo demo off of the SDL demo page, compiled
it, and it started up just fine.

I'm trying to start up a 32 bit video mode, but when I
tried a 16 bit one, I got a segfault.

maybe it'll help if you see my initialization code -

//heres the code
/*gs_ScreenInfo is a structure containing video
information
that was previously set from a config file*/
//trying to set a 32 bit mode
//set opengl junk
    if (gS_ScreenInfo.i_ScreenType & SDL_OPENGL)
    {
        printf ("OpenGL active\n");
        SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
        SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
        SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
        SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 8 );
        SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 32 );
        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 0 );
    }

    //try to set video mode
    if ((gS_ScreenInfo.surf_Screen = SDL_SetVideoMode
(gS_ScreenInfo.i_ScreenWidth,
                                       
gS_ScreenInfo.i_ScreenHeight,
                                       
gS_ScreenInfo.i_ScreenBPP,
                                       
gS_ScreenInfo.i_ScreenType)) == NULL)
    {
        printf ("Error setting video mode:
%s",SDL_GetError ());
        return FAILURE;
    }

This code works without a hitch in windows. Am I
missing something? Do I need to link with anything
other than libGL? I've never really messed with
OpenGl, so I don't know.

Oh well, it's not critical. I'm writing a general
purpose emulator front end, (it supplies the gui, you
supply the emulator =), and I guess I should get 2d
support working before even considering 3d.

Thanks,



=====
Michael Cowart
Department of Computer Engineering, University of Arkansas
cutefuzzysquirrel at yahoo.com

"Elen sila lumenn' omentielvo" - a star shines on the hour of our meeting

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com




More information about the SDL mailing list