How do I make sure that my code is hardware accelerated?

I have written a few basic programs in OpenGL and all of them seem to run fine. But what I have been wondering is, ‘Are my programs in fact utilizing OpenGL hardware acceleration ar are they just being rendered in software?’

And if not they how do i make sure that the code I write makes use of OpenGL acceleration(hardware)?, if possible.

Thanks in advance.

Hi !

When you have setup your rendering context you can call glGetString( GL_RENDERER), this will return a string containing “Microsoft” something if you are using software rendering and another name related to the manufacturer/hardware you are using if you are using HW acceleration.

Mikael

First thing to check is the renderer of the rendering context you get. use glGetString(GL_RENDERER) for this.
The renderer name should be your graphics card name (GeForceXXXXX, RadeonXXXX, etc…). If you get something else (eg Microsoft GDI Generic), you’re 100% sure you have software rendering.

Now, getting “yourcardsnamehere” renderer only means that your program correctly calls directly your graphics driver (and is not redirected to the OS generic graphics routines). However, your graphics driver has several paths for execution of the different features of OpenGL. Some of them are HW accelerated, some others are not. If you use a feature that is not accelerated, you will still get software rendering (done by the driver, not the OS). You will know that because of a huge slowdown (probably single-digit fps).

Summary : if you get a proper rendering context, HW acceleration is automatic. You use OpenGL commands, and the driver makes what it can to use available hardware. If there is no hardware for some command, the driver will execute it in software.