i’m trying to create a program where a click of a button will create a new window which would carry out animation…
i first programmed the animation and made sure they were working before i linked it to run on a new window when the button was clicked. the second opengl window creates alright but my animation is screwed up…introducing some abnormalities and also models dont display properly(display like 2D shadows)…
cant quite understand why
static void TheButtonCallback8()
{
if(window2==0){
window2 = glutCreateWindow("animation");
glutDisplayFunc(display2); //animation display
glutReshapeFunc(OnReshape);
glutIdleFunc(onIdle1);
}
printf("Run Animation");
}
void OnIdle1()
{
if(window2 != 0)
{
rY += 0.05;
glutPostWindowRedisplay(window2);
}
else
{
glutIdleFunc(0);
glutDestroyWindow(window2);
glutPostWindowRedisplay(window1);
window2 = 0;
rY = 0;
}
}
void main(int argc, char** argv) {
atexit(OnShutdown);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowSize(width, height);
//glutCreateWindow("GLUT Picking Demo [using selection buffer]");
// Make Main outer window
window1 = glutCreateWindow("Satellite Assembly");
glutDisplayFunc(OnRender);
glutReshapeFunc(OnReshape);
glutIdleFunc(onIdle);
glutKeyboardFunc(OnKey);
glutSpecialFunc (keyboard_s);
glutMouseFunc(Mouse);
glutMotionFunc(Motion);
glutPassiveMotionFunc(MousePassiveMotion);
InitGL();
glutMainLoop();
}
am i supposed to create separate callbacks for each window
thanks