PDA

View Full Version : Scene only draws after mouse moves



Rajveer
03-28-2002, 07:23 AM
I've downloaded the demo project here: http://www.codeguru.com/opengl/oglwrapperclass.shtml

and I'm just messing around with it to learn opengl. One thing I did was, I added submenus to draw extra shapes. I've defined a global:
int state=0;
I did it such that, when you select that menu, state toggles between 0 and 1 each time you click it. Then in my OnDraw() function, I added this code:
if(state==1)
{
//draw the extra shape
}

but the extra stuff doesn't draw until I click on the scene and drag the cursor, then when I select the menu again to remove the shape, once again.....it doesn't remove until I click and drag the cursor. What could be causing this??

[This message has been edited by Rajveer (edited 03-28-2002).]

nexusone
03-28-2002, 07:28 AM
Are you using the glutIdleFunc or glutTimerFunc to make your screen update?

It sounds like you are not telling openGL to update the screen after a mouse event.



Originally posted by Rajveer:
I've downloaded the demo project here: http://www.codeguru.com/opengl/oglwrapperclass.shtml

and I'm just messing around with it to learn opengl. One thing I did was, I added submenus to draw extra shapes. I've defined a global:
int state=0;
I did it such that, when you select that menu, state toggles between 0 and 1 each time you click it. Then in my OnDraw() function, I added this code:
if(state==1)
{
//draw the extra shape
}

but the extra stuff doesn't draw until I click on the scene and drag the cursor, then when I select the menu again to remove the shape, once again.....it doesn't remove until I click and drag the cursor. What could be causing this??

[This message has been edited by Rajveer (edited 03-28-2002).]