[PyOpenGL-Users] glVertexArrayd slows performance
Brought to you by:
mcfletch
From: Douglas T. <dt...@sk...> - 2006-02-05 00:46:40
|
Hi, I've been trying to improve a dot drawing routine and I tried the vertex array method but it slows performance by a factor of 2. My testing machine runs Mac OSX 10.3.9 and has PyOpenGL version 2.0.2.01 . I tried allocating the xyData array 2 ways and both have the same performance 1) xyData = RandomArray.uniform(0.0,1.0, (NUM_POINTS,2)) 2) xyData = Numeric.zeros( (NUM_POINTS,2), 'd') and the code looks as if use_vertex_array == False: glColor4f(1.0, 0.0, 0.0,1.0); glBegin(GL_POINTS); for i in range(NUM_POINTS): glVertex3f(xstart[i],ystart[i],zstart[i]); glEnd() else: # Pass a pointer to the start of the point-coordinate array: glColor4f(0.0, 1.0, 0.0,1.0); xyData[:,0] = xstart xyData[:,1] = ystart glVertexPointerd(xyData); glEnableClientState(GL_VERTEX_ARRAY); glDrawArrays(GL_POINTS, 0, len(xstart)); glDisableClientState(GL_VERTEX_ARRAY); By timing parts of the code it spends most of it's time in glVertexPointerd(xyData); the call to glDrawArrays(GL_POINTS, 0, len(xstart)); is quite fast. Am I doing something wrong here? Any help would be greatly appreciated. Thanks, Doug Taylor |