PDA

View Full Version : problems using TMainMenu in C builder



Ethan
08-10-2001, 06:29 AM
Hi!
I'm just beginning to play with openGL and C++ builder together and I had a little problem using TMainMenu:

I'm just trying some animations with openGL,
like to draw a triangle and rotating it with
glRotate. But, with an Menu item in my form,
when I activate it (clicking an item like File/Open) everything is "freezed" in my
animation, until I leave the menu item.

Does anyone knows how to overcome this, i.e, how to keep my animations working while I'm working with the menu??

Thanks in advance for any help on this matter!

NOAH IV
08-10-2001, 11:41 AM
Hi Ethan,

I use Builder too, but my OpenGL doesnt freeze if I change the focus...
It depends on the way you created the ogl context...
Are you using any component?

You probably put your rendering code in the "Application->OnIdle", try a timer or thread...
Hope it helps.

Falou!

[This message has been edited by NOAH IV (edited 08-10-2001).]

Ethan
08-14-2001, 09:06 AM
Hi NOAH,
I'm not using components, but my rendering
procedure is inside Aplication->OnIdle, and I don't know how to do it by other way.
Can you send me some sample code or nay tutor?

Thanks ! (valeu!)

MButchers
08-15-2001, 02:29 AM
Hi there,

Place a timer on your form and set the
interval to 1 this will update as often as
possible then in the on timer event call your
rendering routine ie

void __fastcall TfrmMain.Timer1OnTimer(Sender: TObject);
{
RenderScene;
}

it may also be usefull to toggle this on and
off depending on user set flag and keep the
onidle,onmessage routines as these tend to
be smoother..

Hope it helps

Mark