OpenGL hardware acceleration not working?

Started by
7 comments, last by Brother Bob 12 years, 6 months ago
Hello all,

This is my first post on these forums and I'm not a 100% sure if this post should be here in the OpenGL section or in the graphics programming and theory section, but I'm sure a friendly community member will point me in the right direction if this is the wrong place :)

Anyway, here is my problem:
I don't think I have hardware acceleration on my OpenGL applications. What leads me to believe this is that I have a laptop with integrated graphics (Intel HD graphics) and an nvidia graphics card that I can switch on and off (to save battery life I guess). But when I run my application with my graphics card turned on the frame rate drops significantly, this leads me to believe that all OpenGL rendering is being done on the software and not on the hardware.

Here are two screenshots from the same application, one running on intergrated graphics (Left) and one running on the graphics card (Right):
fontproblem.png

Here are some more information:
I'm using SDL to handle windows/input ect, OpenGL to render, and for the fonts I use the tutorial from NeHe on true type font rendering (using display lists).
My IDE is Visual Studio Professional (Student license)
I'm running windows 7 64 bit, Intel core i7 processor and Nvidia GeForce GT 540M graphics card.

I guess my question is: Does anybody now why it's running slower with my graphics card turned on, and what can I do to fix it?
I'm not very experienced with OpenGL so it might be something really simple that I forgot to turn on or something like that...

(Also, does anybody know if there is a function in OpenGL to check for hardware acceleration support, like glHardwareAcceleration() or something like that?)

/Lars
Advertisement
That 60 frames per second is likely locking to the frame rate of your screen refresh rate, which is 60 Hz. It just means that instead of rendering at full speed, rendering is just capped at the refresh rate. You most likely have hardware rendering.
Your right! I tried to render a lot of text and when running it on the integrated graphics it dropped to 15 fps, but on the graphics card it stayed on 59-60 fps :)
Thank you very much for the quick response! :)

I guess I have another question then. Is there any way to make sure it's not locking the frame rate? It's probably good when running a final game/application but when developing it I would like to see exactly how well my code preforms :)
It's platform dependent, but you can use the following wgl extension on windows:
http://www.opengl.or...wap_control.txt
That should be supported by pretty much every driver from this millennium <_<

Also make sure vsync isn't forced on or off in the control panel of your graphics card.
You can use this code to turn on and off vsync, but it's an extention so you have to load it at run time:

Add this in your header:
typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);
PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT;

then add this after opengl is initialized:
if(CheckExtension("WGL_EXT_swap_control"))
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("wglSwapIntervalEXT");

CheckExtension is my own routine to check if an extention is availlable, so you'll have to do this yourself. You can also remove the if statement and check if it return NULL for failure.
Turning vsync off from the control panel did the job.
Thanks a lot guys :)
As an addendum, if you weren't getting hardware acceleration you'd be running a LOT slower than 60 FPS - even with a fast CPU. 1 FPS or lower is typical.

It's interesting to note that my NVIDIA control panel has some text advising to use the control panel for vsync under OpenGL but the app setting under D3D, which I'm reading as a hint that WGL_EXT_swap_control doesn't actually work on (at least this) NVIDIA hardware.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

^ ahh thats good to know! I just took an extra look at my nvidia control panel and I see that mine says the same :)

As an addendum, if you weren't getting hardware acceleration you'd be running a LOT slower than 60 FPS - even with a fast CPU. 1 FPS or lower is typical.

Such a trivial rendering as in his initial post can easily do 60 FPS with the default software renderer for Windows.

This topic is closed to new replies.

Advertisement