Re: [PyOpenGL-Users] Request for help for updating OpenGL view
Brought to you by:
mcfletch
From: <il...@ya...> - 2003-01-24 03:19:09
|
Hi, does the robot move every frame? If not you could simply not flip the back buffer, until it moves. Or maybe you could limit the frame rate to say 30fps, and sleep for the rest of the time. How are you drawing it? glBegin/glEnds use up a bit of processing power looping through all the data. Whereas drawing arrays will use your graphics card instead of the cpu if the card is a recent one. Even without a t&l card avoiding loops in python can speed things up a lot. So try and avoid the glBegins/ends if you are using them. If none of that helps maybe you could make an example of your code without the robot attached ;) So that we could play with it a bit. Of course I'm sure it's much more fun with a robot. --- "Douglas S. Blank" <db...@br...> wrote: > PyOpenGL-users, > > I was wondering if someone could point me to some > example code, or give me > some hints. Here's what I need to do: > > I have a GUI that has one Python thread updating > some values (a robot's > sensors actually), and I'd like to have an OpenGL > view of the robot updated as > often as possible without stressing the computer too > much. The OpenGL should > draw the robot and sensors, but also allow > rotating/zooming/etc the view of > the robot via the mouse, or programmatically. > > I have a hacky version working that uses the > do_AutoSpin method, but sets > xspin and yspin to 0 so that it doesn't really spin > it, but it does update the > window: > > def refresh(self): > self.win.autospin = 1 > self.win.xspin = 0 > self.win.yspin = 0 > self.win.after(500, self.win.do_AutoSpin) > > Besides being hacky, this has some problems: > > 1. it uses about 98% of a CPU > 2. If you change the view (rotate/zoom the robot) > in the OpenGL window, you > have to run the above refresh() method again > > Can any help point me to the proper way of having > this functionality? > > Thanks in advance! > > -Doug > __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com |