[SDL] Detect If OpenGL Is Working?

Alex Barry alex.barry at gmail.com
Wed Jun 9 09:50:59 PDT 2010


It looks like you want to use this command:
http://www.libsdl.org/cgi/docwiki.cgi/SDL_GetVideoInfo
use like this:

// Set the video mode....

SDL_VideoInfo *info = SDL_GetVideoInfo( );
if( !(info->hw_available) ) {
  printf( "Probably using Mesa opengl implementation" );
}

Does that help/work?
-Alex

On Wed, Jun 9, 2010 at 12:46 PM, Jesse Palser <slnthero at aol.com> wrote:

> Hi,
>
> //-----------------------------------------------------------------------
> Screen = SDL_SetVideoMode(width, height, 0, SDL_OPENGL | SDL_RESIZABLE);
> if (!Screen)
> {
>    printf("ERROR: SDL+OpenGL resizable window create failed\n");
>    return false;
> }
> //-----------------------------------------------------------------------
>
> Above does not fail on a platform that definitely does NOT have OpenGL.
> (on a Windows XP Virtual Machine on a NetBook running Ubuntu 10.04)
>
> I was told by others on the list that if OpenGL is not present
> then SDL will goto some type of software rendering.
> (but this OpenGL software rendering is much slower than native SDL)
>
> Just looking for a way to test if OpenGL is working...
> (so I can switch to faster SDL native blitting)
>
> Thanks!
>
> Jesse
>
>
> On Wed, 2010-06-09 at 12:28 -0400, Donny Viszneki wrote:
> > Will SDL_SetVideoMode() fail if OpenGL is requested and it's unavailable?
> >
> > On Wed, Jun 9, 2010 at 12:10 PM, Jesse Palser <slnthero at aol.com> wrote:
> > > Hi,
> > >
> > > I've Google'd for hours and can't seem to find it.
> > > --------------------------------------------------------
> > > How do I detect if OpenGL is working?
> > > --------------------------------------------------------
> > > I am using SDL 1.2 + OpenGL.
> > > (need a cross-platform solution)
> > >
> > > On old computers where OpenGL is not available,
> > > I would like to be able to detect that
> > > and fall back onto standard SDL 1.2 for drawing...
> > >
> > > Thanks!
> > >
> > > Jesse
> > >
> > > _______________________________________________
> > > SDL mailing list
> > > SDL at lists.libsdl.org
> > > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
> > >
> >
> >
> >
>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100609/30de16f0/attachment.htm>


More information about the SDL mailing list