Sign in to follow this  
lupin982

OpenGL frame rate and scheduling problems NEED HELP

Recommended Posts

Dear friends, i have a problem explained in the follow: I use the linux OS. I have 2 function "processData(parameters)" and "display(parameters)" this 2 function share the data with a shared memory. processData function process the data displayed from the display function, for this the display function must be recall after the processData function. I recall the display function with opengl; in the main function i use glutDisplayFunc(display); The processData function is recalled with a simple posix timer every 20 milliseconds, the frame rate is 20 msec. the project schema is this: processData(parameters) | | shm | | display(parameters) ----------------------------------------- void processData(parameters) { ... process data put data in shared memory ... } void diaplay(parameters) { ... diplay shm data provided from the processData function ... } int main(int argc, char **argv) { int sigNumber = signal number; //assign to sigNumber 55 posixtimer scheduler(dataProcess, sigNumber); //define posix timer scheduler.start(20); // 20 msec is the frame rate ... init gl function ... glutDisplayFunc(display); glutIdleFunc(idle); } The problem is that the display function mast be recall always after the processData function and not with the opengl frame rate (glutDisplayFunc(display)). Another problem is that in some frame the processData function can require more then frame time, in this case i want to display the previous frame data. I try to resolve that problems with semaphore in the 2 function procesData and diplay, i accomplish in this mode to call the diplay function after the processData function, bat in some frames i diplay black data because in that frames the processData use more than 20 msec to process the data e put that in the shared memory. I don't know what happened in that cases because in the shared memory should be the previous frame data. Can anyone suggest me how i can resolve that problems? Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this