PDA

View Full Version : multi threading in openGL



jayaprakash
01-29-2009, 03:42 AM
Hi,
I am new to openGL.
I would like to use openGL in video decoding and display decoded video using mutlti threading.
While running video decoder after completion of one frame decoding
I will get the YUV data for that frame then convert this YUV into RGB and I should able to display on the
screen using openGL. Once that frame displaying is over i should able to come back and decode the secound
frame by calling the decoder function and then display again the newly decoded frame, like this i need to
run the application upto end of file.
For this i used the following code
glutDisplayFunc(display);
glutMainLoop();
display function will use the image poiter.

But my problem is once glutMainLoop() function is called it is not allowing to execute the decoder functions.
So is there any method to comeout from glutMainLoop() after displaying one frame? so that i can decode the
next frame and then i will call display function again.

One more doubt is it necessary to write all GL related functions like display, reshap .. in the main function
or we can write and call from any where from the application?

Sorry for my bad english.

Thanks & Regards
Jayaprakash

Shinta
01-29-2009, 07:19 AM
Try using glutMainLoopEvent() (http://freeglut.sourceforge.net/docs/api.php#EventProcessing)
or use a timer callback with glutTimerFunc(...) (http://freeglut.sourceforge.net/docs/api.php#GlobalCallback).