PDA

View Full Version : updating window from another file



jayaprakash
02-17-2009, 05:34 AM
Hi all,

I am using openGL in my application for displaying only.
I have two C files in my project. I wnated to initialize window and creating window in main C file and i wnated to update the window from another C file. Is it possible?
I used in the following way then window is creating but window is not updating with new data. just itis stationary.
In main.c
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(720,480);
glutInitWindowPosition(100,100);
getwin = glutCreateWindow(argv[0]);
init();
In another C file
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMouseFunc(mouse);
glutIdleFunc(startDisplay);
glutMouseFunc(Key);
glutMainLoop();
Is there any other ways to do for this.
Please suggest me.

Thanks & Regards,
Jayaprakash

scratt
02-17-2009, 11:16 AM
You need a redraw function and something to trigger it / call it, otherwise it will never update.

You can test this quickly by putting a call to redraw inside your Key callback function.
Each time you press a key the screen should then update.

Also you will most likely find at the moment that the screen redraws when you resize it, if you are using a standard template for your functions.