Regarding the OnPaint event
I think the problems with the (outcommented) OnPaint-Event are related to the following section of the wxWidgets documentation of the wxPaintEvent:
<cite>Note that In a paint event handler, the application must always create a wxPaintDC object, even if you do not use it. Otherwise, under MS Windows, refreshing for this and other windows will go wrong.</cite>
<strike>I don't know what OS the original author used, but with my MS Windows XP, this is definitely true.</strike>
Since this currently only works with Windows... please ignore this
void wxOgre::OnPaint(wxPaintEvent& event) { update(); }write:
void wxOgre::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); update();}
and the event works as expected, at least for me.
Also, I noticed that OnEraseBackground and OnPaint are always called together, so I removed the OnEraseBackground-Event from my app. The documentation indicates that this is the case because on some plattforms the event is simulated and raised everytime OnPaint is raised. Since I work under Windows XP, it seems this OS is one of those...
Regards, Crayzee Ivan
Linux GTK Code Test
I tested the wxOgre class on linux and it does not work.
I have found that the value for window is always 0 after the following line of code:
GdkWindow * window = GetHandle()->window;
This would imply that is not initialized on startup and a recent discussion in this wxWidgets forum thread would seem to confirm this.
<cite>The problem is that in order to get a valid xid your window needs to be
realized first, and if its not then you need to connect to the realize
event and handle it there.</cite>
Regards, George