wxMac - continuous rotation of graphics
Eric Dowty
edowty at shapesoftware.com
Wed Sep 20 13:17:57 PDT 2006
Hello:
In upgrading from wxWidgets 2.4 to 2.6, I encountered speed problems with g=
raphics redraw. If I continously redraw while rotating a moderately comple=
x object, the speed is about half as fast with wx 2.6 (also 2.7) as 2.4. M=
y code is the same for both 2.4 and 2.6 except as noted below
At the moment, I am compiling wx 2.4 with Metrowerks, and wx 2.6/2.7 with X=
Code, but I doubt if the compiler could make this much difference - there i=
s no evidence of any problem elsewhere. Rather, I am guessing it is a diff=
erence in the wxWidgets event loops between 2.4 and 2.6/2.7.
Here is an outline of the code - a loop which just rotates and redraws cont=
inuously:
--------------------------------
PushEventHandler(new MyEvtHandler(this)); //handler for buttons, mouse
while( TRUE ) { =
rotate(); //rotates object
wxYield(); =
#if !defined(__WXMAC__) or (wxMINOR_VERSION =3D=3D 4) =
redrawgraph( ); //does OnPaint - skip this for wx 2.6 ONLY
#endif
if( wxgen.quitnow ) goto stoploop; //quitnow flag set if user hits butt=
on or mouse
} =
stoploop: =
PopEventHandler(TRUE);
--------------------------------
Note that redrawgraph(), which directly calls ::OnPaint, is needed for 2.4 =
but not 2.6.
The same sort of problem occurs if the user rotates with the mouse. The sp=
eed comparison is for PPC, but I suppose that Intel code has the same probl=
em (I have not tried to load wxWidgets 2.4 on an Intel machine and compile =
it with XCode).
How could I get V2.6/2.7 to redraw at maximum speed? Is there some wait cy=
cle which could be disabled? Does someone have some code for a redraw loop=
, for example rotating an object with the mouse, that really is as fast und=
er 2.6 as 2.4?
Would it make sense to try a completely native event loop, as in the GLCarb=
onAGLWindow sample (for example?)?
Eric Dowty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20060920/5ba=
76f97/attachment.htm
More information about the wx-users
mailing list