Re: [PyOpenGL-Users] openglcontext 2.0 problem
Brought to you by:
mcfletch
From: <il...@ya...> - 2003-02-02 01:20:11
|
--- gabor <ga...@re...> wrote: > hi, > > 1. > i've created a simple app using testcontext. my > render method looks like > this: > def Render(self, mode = 0): > BaseContext.Render(self,mode) > glDisable(GL_CULL_FACE) > > t = time.time() > for trilist in self.tris: > glVertexPointerd(trilist ) > > glEnableClientState(GL_VERTEX_ARRAY); > glDrawArrays(GL_TRIANGLES, > 0,len(trilist)) > > t = time.time() -t > > print "renderTime",t * Try this? if self.tris: glEnableClientState(GL_VERTEX_ARRAY); for trilist in self.tris: glVertexPointerd(trilist ) glDrawArrays(GL_TRIANGLES, 0,len(trilist)) if self.tris: glDisableClientState(GL_VERTEX_ARRAY); If it's not much faster then, maybe one of these functions is copying the memory each time. How long is trilist usually? Does glVertexPointerf work for you? > 1000.0,"milliseconds" > > i'm rendering around 1500-2000 wireframe triangles > this way, and it's > too slow... i got renderTime around 37 > miliseconds..., that means around > 30fps... > > if i do it with the gl functions commented out i got > aroun > 0.007 miliseconds... > > does that rendering take so long? > > then i replaced that glVertexpointer code with: > glBegin(GL_TRIANGLES) > for v in trilist: > > glVertex3f(v[0],v[1],v[2]) > glEnd() > > and it renders in around 28 miliseconds... it's > faster ?!?!?!?!?!?! > > what am i doing wrong? > > > 2. > a have meshes defined as list of triangles... i need > to do be able to > pick a triangle of it with the mouse... in the past > i used glUnproject > to get the mouse coords, and then doing the > intersection math... > is there something on OpenGLContext2 that i could > use for this? > > thanks, > gabor > > __________________________________________________ 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 |