How to know if (direct render) hardware accelerated is available

With ‘direct render’ I was meaning “hardware accelerated”.
Is there any way to be sure that hardware accelerated is available?

I was thinking that maybe with GL_VENDOR and GL_RENDER I could
determine that, but I’m not really sure if that is the best way to do
it.

The SDL_SysWMinfo has de Display, but I’m missing the GLXContext.

David.On Nov 16, 2007 3:49 AM, Solra Bizna wrote:

On Nov 15, 2007 6:55 PM, David Roguin <@David_Roguin> wrote:

I want to know for a program running in linux if direct rendering is abailable.
I believe glXIsDirect does the trick.
The question is, can I call this function within a SDL context?
SDL under X11 uses GLX internally for OpenGL, so I would assume so. I
can think of two caveats, though.

  1. You’ll need a Display and a GLXContext to pass to the function, and
    I’m not sure how you’d get your hands on those.
  2. If you’re taking “direct rendering” to mean "hardware accelerated,"
    remember that indirect rendering can be accelerated too. For example,
    if X11 forwarding is in effect, rendering may be hardware accelerated
    (and reasonably fast) but glXIsDirect will return False. (I’m not sure
    how AIGLX fits in.)
    -:sigma.SB

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

With ‘direct render’ I was meaning “hardware accelerated”.
Is there any way to be sure that hardware accelerated is available?

I was thinking that maybe with GL_VENDOR and GL_RENDER I could
determine that, but I’m not really sure if that is the best way to do
it.

That will work, but it requires that you have a list of valid vendor
names which can be a real pain to generate. The simple way is to run a
simple test and measure the performance. Just put a spinning logo at
load time for maybe 10 seconds. If you don’t get a high enough frame
rate you know that you do not have accelerated graphics. If you do get a
good frame rate you know a little more. You can even just measure the
frame rate of the main application and if it is too slow, you can
politely quit.

Bob PendletonOn Fri, 2007-11-16 at 09:44 -0300, David Roguin wrote:

The SDL_SysWMinfo has de Display, but I’m missing the GLXContext.

David.

On Nov 16, 2007 3:49 AM, Solra Bizna wrote:

On Nov 15, 2007 6:55 PM, David Roguin wrote:

I want to know for a program running in linux if direct rendering is abailable.
I believe glXIsDirect does the trick.
The question is, can I call this function within a SDL context?
SDL under X11 uses GLX internally for OpenGL, so I would assume so. I
can think of two caveats, though.

  1. You’ll need a Display and a GLXContext to pass to the function, and
    I’m not sure how you’d get your hands on those.
  2. If you’re taking “direct rendering” to mean "hardware accelerated,"
    remember that indirect rendering can be accelerated too. For example,
    if X11 forwarding is in effect, rendering may be hardware accelerated
    (and reasonably fast) but glXIsDirect will return False. (I’m not sure
    how AIGLX fits in.)
    -:sigma.SB

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


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

I’m working in a graphic library for making games, I want to use
OpenGL and SDL in case that accel hardware is not available; that’s
why I need to check before rendering anything in screen.

I was thinking, if I test if the GL_RENDER is Mesa, I’m sure that not
hardware accel is present. But is there another soft OpenGL
implementation besides Mesa?

David.On Nov 16, 2007 3:35 PM, Bob Pendleton wrote:

On Fri, 2007-11-16 at 09:44 -0300, David Roguin wrote:

With ‘direct render’ I was meaning “hardware accelerated”.
Is there any way to be sure that hardware accelerated is available?

I was thinking that maybe with GL_VENDOR and GL_RENDER I could
determine that, but I’m not really sure if that is the best way to do
it.

That will work, but it requires that you have a list of valid vendor
names which can be a real pain to generate. The simple way is to run a
simple test and measure the performance. Just put a spinning logo at
load time for maybe 10 seconds. If you don’t get a high enough frame
rate you know that you do not have accelerated graphics. If you do get a
good frame rate you know a little more. You can even just measure the
frame rate of the main application and if it is too slow, you can
politely quit.

Bob Pendleton

The SDL_SysWMinfo has de Display, but I’m missing the GLXContext.

David.

On Nov 16, 2007 3:49 AM, Solra Bizna wrote:

On Nov 15, 2007 6:55 PM, David Roguin <@David_Roguin> wrote:

I want to know for a program running in linux if direct rendering is abailable.
I believe glXIsDirect does the trick.
The question is, can I call this function within a SDL context?
SDL under X11 uses GLX internally for OpenGL, so I would assume so. I
can think of two caveats, though.

  1. You’ll need a Display and a GLXContext to pass to the function, and
    I’m not sure how you’d get your hands on those.
  2. If you’re taking “direct rendering” to mean "hardware accelerated,"
    remember that indirect rendering can be accelerated too. For example,
    if X11 forwarding is in effect, rendering may be hardware accelerated
    (and reasonably fast) but glXIsDirect will return False. (I’m not sure
    how AIGLX fits in.)
    -:sigma.SB

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


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


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ah, but here you hit another problem… :slight_smile:
Most “Free” 3D drivers report themselves as some variant of “Mesa
DRI.” So, you might think you could make an exception to the rule by
checking for “DRI” in the RENDER string… but, alas, it’s not that
simple, as often DRI is reported in the RENDER string despite the lack
of worthwhile hardware acceleration. (Mach64 anyone? Or the Creator3D,
on which texture mapping is not accelerated?)

All hope is not lost, though, since SDL now has a GL attribute you can
use to request hardware acceleration (SDL_GL_ACCELERATED_VISUAL). I
haven’t used it, so I don’t know how extensive backend support is, but
at least there’s the potential. (Not to mention being
cross-platform…)
-:sigma.SBOn Nov 16, 2007 7:01 PM, David Roguin wrote:

I was thinking, if I test if the GL_RENDER is Mesa, I’m sure that not
hardware accel is present. But is there another soft OpenGL
implementation besides Mesa?

I’m working in a graphic library for making games, I want to use
OpenGL and SDL in case that accel hardware is not available; that’s
why I need to check before rendering anything in screen.

I was thinking, if I test if the GL_RENDER is Mesa, I’m sure that not
hardware accel is present. But is there another soft OpenGL
implementation besides Mesa?

OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel® 915GM 20061017 x86/MMX/SSE2
OpenGL version string: 1.3 Mesa 7.0.1

I got Mesa in the renderer string but it’s still hardware accellerated.On Fri, Nov 16, 2007 at 04:01:52PM -0300, David Roguin wrote:

David.

It seems SDL_GL_ACCELERATED_VISUAL is what i want.

Thanks a lot for your responses.
David.On Nov 16, 2007 5:54 PM, Solra Bizna wrote:

On Nov 16, 2007 7:01 PM, David Roguin <@David_Roguin> wrote:

I was thinking, if I test if the GL_RENDER is Mesa, I’m sure that not
hardware accel is present. But is there another soft OpenGL
implementation besides Mesa?
Ah, but here you hit another problem… :slight_smile:
Most “Free” 3D drivers report themselves as some variant of “Mesa
DRI.” So, you might think you could make an exception to the rule by
checking for “DRI” in the RENDER string… but, alas, it’s not that
simple, as often DRI is reported in the RENDER string despite the lack
of worthwhile hardware acceleration. (Mach64 anyone? Or the Creator3D,
on which texture mapping is not accelerated?)

All hope is not lost, though, since SDL now has a GL attribute you can
use to request hardware acceleration (SDL_GL_ACCELERATED_VISUAL). I
haven’t used it, so I don’t know how extensive backend support is, but
at least there’s the potential. (Not to mention being
cross-platform…)

-:sigma.SB


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org