wxIrrlicht problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
yablebab
Posts: 5
Joined: Wed Sep 20, 2006 9:20 pm
Location: Berkeley, CA

wxIrrlicht problem

Post by yablebab »

I'm using a wxIrrlicht control, along with a seperate frame to interact with the graphcis on screen. ( http://www.rpi.edu/~amadib/Screenshot1.bmp ) I want the frame with all the controls to be dockable, so I used a wxFrameManager and added the notebook as the only pane. The problem is that when I move the frame around the screen, particularly when it moves over the wxIrrlicht control, the program freezes and I have to open the Task Manager to kill it. It would do the same thing when I tried to dock or undock the frame. I tried several solutions:

1st: add

Code: Select all

EVT_CHILD_FOCUS(IrrFrame::OnSetFocus)
to the event table for the parent window. then:

Code: Select all

void IrrFrame::OnSetFocus(wxChildFocusEvent& event)
{
    if(event.GetWindow() == ToolFrame)
    {
        irrWin->StopRendering();
    }
}
irrWin is the name of the wxIrrlicht control and ToolFrame is the name of the wxWindow that contains the wxNotebook.

But calling wxIrrlicht::StopRendering() inside this function caused the program to crash.

Next I tried to change wxIrrlicht::StartRendering so it looks like this:

Code: Select all

void wxIrrlicht::StartRendering(int milliseconds)
{
    if(FindFocus() == this){   //added this if statement
        m_Timer.Start(milliseconds);
    }
}
And this worked surprisingly well. Now the wxIrrlicht control won't render as long as another window is the focus. This stopped the program from crashing when I docked or undocked ToolFrame or when I dragged it over the wxIrrlicht control.

But here's the meat of the problem: I need the wxIrrilcht control to continue rendering when the ToolFrame is in focus, so that the checkboxes and sliders can dynamically control what's on the screen. But I need it to stop rendering when the ToolFrame is being moved around the screen or being docked or undocked.

I tried adding

Code: Select all

EVT_MOVE_EVENT(OnMove)
to the event table for the toolframe and then defining

Code: Select all

ToolFrame::OnMove(wxMoveEvent& event)
{
       irrWin->StopRendering();
}
but this seemingly had no effect. Any suggestions/answers are much appreciated.

Thanks in advance

Brian
Post Reply