From: Douglas Taylor <dtaylor@sk...> - 2006-02-05 00:46:40
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);
for i in range(NUM_POINTS):
# 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
glDrawArrays(GL_POINTS, 0, len(xstart));
By timing parts of the code it spends most of it's time in
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,
From: Simon Wittber <simonwittber@gm...> - 2006-02-05 02:06:43
On 2/5/06, Douglas Taylor <dtaylor@...> wrote:
> By timing parts of the code it spends most of it's time in
> 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,
Try sending the array to OpenGL via one glVertexPointerd call, before
you start the render loop. Then, call glDrawArrays once per frame as
There is no need to send the array down the pipe for every frame,
unless of course the vertex data changes every frame.
Get latest updates about Open Source Projects, Conferences and News.