Jump to content
  • Advertisement
Sign in to follow this  
Laitch

OpenGL OpenGL hardware acceleration not working?

This topic is 2618 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!