Jump to content
  • Advertisement
Sign in to follow this  
behjat

OpenGL Frame Rate in opengl

This topic is 4805 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

Hi all, I am using opengl for hand-tracking. I am taking the data from a camera, passing it to a Cg program through buffers and performing some calculations on the data, then writing the output to a buffer and finally rendering the buffer using opengl. The frame-rate is 10-11 fps. The CPU application alone(taking data from the camera) can run at 15 fps, is it possible that the CPU and the GPU are not running parallely? Increasing the load on the GPU dosen't decrease the frame rate, however increasing the load on the cpu does. What could be the problem? thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by behjat
passing it to a Cg program through buffers and performing some calculations on the data, then writing the output to a buffer and finally rendering the buffer using opengl.


Seems like that is where you are losing your FPS as that must happen on the CPU, however, if you can I would spend time optimizing your camera routines. as 15fps itself isn't very fast.

Share this post


Link to post
Share on other sites
Obviously the problem is that you're doing too much on the CPU. There's a certain amount of CPU side cost associated with rendering, which accounts for the drop from 15fps to 10fps.

Share this post


Link to post
Share on other sites
For the camera I am using the opencv library, I think that that should be already optimised. I have another query, the opencv library has its own callback function and there is a problem using it alongside opengl. my code is like this

int main ( int argc, char** argv ){
glutInit(&argc, argv);
glutInitWindowSize(SCREENW, SCREENH);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutCreateWindow("Output");

init_opengl();

glutDisplayFunc(display);
glutIdleFunc(idle);
glutKeyboardFunc(key);
glutReshapeFunc(resize);

cvNamedWindow("cvcam window", CV_WINDOW_AUTOSIZE);
ShowCamVideo((HWND)cvGetWindowHandle("cvcam window"), SCREENW, SCREENH);
glutMainLoop();
cvcamExit();
return 0;
}


The ShowCamVideo() and the glutMainLoop() functions are not synchronous, i.e. glut sometimes processes more than 1 camera frame. Is there anyway this can be corrected.

thanks

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!