Frame Rate in opengl

Started by
2 comments, last by behjat 18 years, 10 months ago
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
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.
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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

This topic is closed to new replies.

Advertisement