Well, if you are using SDL 1.2.10 or above you set the OpenGL
attribute SDL_GL_ACCELERATED_VISUAL using SDL_GL_SetAttribute() before
you call SDL_SetVideoMode() and you are guaranteed to get a hardware
accelerated visual or nothing at all.
You can check this for your self using glGetString() to get the vendor
and renderer versions and compare them to a list of known bad
renderers. And, you can use GLX (or the equivalent on your favorite
OS) to get the caveat value from each available drawable. If the
caveat == “None” then the visual you are looking at is as fast as
possible on your machine. (Ok, that is true in the mind of the
renderer developer. His opinion may not match yours at all.
On my ancient laptop the vendor and renderer strings look like:
OpenGL vendor string: Tungsten Graphics, Inc.
OpenGL renderer string: Mesa DRI R100 (RV200 4C57) 20090101 x86/MMX/SSE2 TCL DRI
And a visual (aka drawable) that is reasonably fast looks like:
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----------------------------------------------------------------------
0x21 24 tc 0 32 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x22 24 dc 0 32 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0xc1 24 tc 0 24 0 r . . 8 8 8 0 0 0 0 0 0 0 0 0 0 None
If you are going to all that trouble you also need to check the OpenGL
version which you can also get by using glGetString(). On my machine
OpenGL version string: 1.3 Mesa 7.7.1
Which means my renderer supports OpenGL version 1.3 and the software
is Mesa 7,7.1. The Mesa info is most likely of no interest to you but
the fact that I have OpenGL 1.3 tells you want you can an can not
expect my machine to do.
BTW, I got that data by using glxinfo. Wglinfo gives you the same info
on windows and I’m sure there are equivalents on every other OS.
But, here is the key thing to remember. Even if you get a hardware
accelerated OpenGL visual. Even if caveat == None and the vendor and
renderer strings all prove that you have a hardware accelerated
visual, you can not assume that it is fast enough for your game.
Why? Well I have a bunch of machines. The two laptops I have in the
living room that my wife and I use to surf the web, play games, and
fiddle about on facebook while we watch TV are ancient. The one I am
using right now is 7 or 8 years old and the other one is older than
that. Both have hardware accelerated OpenGL and neither is fast enough
to run most games. There are 6 other machines in the house right now
with NVidia graphics cards ranging from a 5700 to a 240 with stops in
the 6000 range, the 9000 range and ending at a fairly new 240.
SDL running on all of those machines will tell that you have hardware
accelerated OpenGL and be telling the truth. But, that is like
comparing a go cart to a formula 1 car. They all have engines, but
they do not all perform at the same level.
My advice is to ask for what you want, and then be prepared to deal
with what you get. IIRC you mentioned that you track the FPS rate of
the game. I would make sure I was requesting a hardware accelerated
visual and not bother to check to see if I got it. I would just track
the FPS and if it is too slow then pop up a message telling the player
that the game is just not going to run fast enough to be fun and then
BTW, you went down the wrong path when you started looking outside of
SDL’s OpenGL functions for the solution to an OpenGL problem. SDL 1.2
has two very different ways of doing graphics; OpenGL, and the other
stuff. The two are pretty much completely separate. Or at least you
will get into the least amount of trouble by assuming they are
I like to stick to OpenGL. YMMV
On Wed, Jun 9, 2010 at 9:03 PM, Leonardo Guilherme <leonardo.guilherme at gmail.com> wrote:
You can try an Linux installation without any mesa library… I guess
you should try to remove it if you’re using Ubuntu, or try anohter
linux distro with a more fine control of packages like archlinux or
gentoo… Cause i think OpenGL will be a dependency of libsdl on
ubuntu, i’m not really sure.
Nathaniel ?is quite right, Windows XP comes with microsoft’s opengl.
2010/6/9 Nathaniel J Fries :
I’m pretty sure Windows XP comes with Microsoft’s software implementation of
Try using a system that doesn’t come with OpenGL, or try to find how to
disable the software implementation.
EM3 Nathaniel Fries, U.S. Navy
SDL mailing list
SDL at lists.libsdl.org
SDL mailing list
SDL at lists.libsdl.org