PDA

View Full Version : controlling window2 through window1



07-22-2003, 07:57 AM
i have 2 windows and 2 different objects

i need:
if the object in window1 moves i want to update the corresponding movement in window 2.
function call and arithmetic calculations works perfectly.

problem
window2 is not updated

I even used setwindow and used 2 glutpostredisplay(), but no change in window. I tried to include changefunction() in window2idlefunction().

again no change in window 2.

how to sort this out?
thanks
mil

starman
07-22-2003, 08:09 AM
I think we'll probably need to see a little more code to help you.

07-22-2003, 03:37 PM
main()
{
........
......
a=window1
draw1(scene1);
reshape();
idlefunca();
....
....
b=window2
draw2(scene1-different view);
reshpae();
idlefuncb()
.....
}

changefunc()
{
move object1;
}

keyboardfunc()
{
if key pressed
changefunc()
glutpostredisplay()
}

also tried this
keyboardfunc()
{
if key pressed
changefunc()
glutpostredisplay()
set window a;
changefunc();
glutpostredisplay
}

idlefunca()
{
changefunc()
glutpostredisplay()
}

is this ok?the reason why i said as 2 different objects because i'm drawing the same scene in two windows using 2 draw functions(both draw functions have same commands- unable to use the same draw function for both the windows check this link for that problem http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/013464.html)

nexusone
07-23-2003, 04:05 AM
From your little code diagram I do about the same thing, but on my dual windows I use only one idle function.
Also only have one window set to read keyboard input.

But really would have to see you actual code to see where there is maybe an error.

Also if you like drop me an e-mail and I will send you my example, maybe will give you an idea on what is going on with your program. If you send an e-mail make sure it has openGL forum in the subject line.




[This message has been edited by nexusone (edited 07-23-2003).]