[visionegg] Re: Dropping into C

Doug,

I think the reason you might have been getting *worse* performance was that
you are (I'm inferring here) calling "glVertexPointer()" inside each call to
draw(). This means that every time draw() is called you are copying all the
data to the driver/hardware, which is exactly what you don't want to do.

In your __init__ method (or something called before you enter the draw()
loop) you should call the glEnableClientState() and glVertexPointer(), and
then in your draw() method call "glDrawArrays()". Don't call
glDisableClientState() at all unless there is some specific reason you need
to.

IMHO, you should be able to achieve the performance you desire without
"dropping into C". If not, and you are running on MacOS X, and have the
developer tools installed, try running the "OpenGL Profiler" tool to help
identify OpenGL calls that are perhaps not necessary and slowing things down
(remembering that OpenGL is a "state machine"). This tool is installed to
"/Developer/Applications/Graphics Tools".

Best,

Simeon

On 1/27/06, Douglas Taylor <dtaylor@xxxxxxx> wrote:
>
> Hi Andrew,
>
> I was trying to optimize the dot drawing routine
> using the Vertex Array method
>
>             xy[:,0] = xstart      #where xy is an [npoints][2] array
>             xy[:,1] = ystart
>            # Pass a pointer to the start of the point-coordinate array:
>             glVertexPointerd(xy);
>            # glVertexPointer(2, GL_DOUBLE, 0, xy); Python did not like
> it this way
>            # Enable fast rendering of arrays:
>             glEnableClientState(GL_VERTEX_ARRAY);
>            # Render all n points, starting at point 0, render them as
> POINTS:
>             glDrawArrays(GL_POINTS, 0, len(xstart));
>            # Disable fast rendering of arrays:
>             glDisableClientState(GL_VERTEX_ARRAY);
>
> and on the Mac(10.3 and 10.4) I actually got worse performance than the
> GL_POINTS loop method. So I would like to drop into C and I found
> the _draw_in_c.c code which looks like a good place to start. I don't
> understand however how you generated the .so file. I couldn't find
> any examples on the Apple site either. I have XCODE and CodeWarrior.
> Could you point me in the right direction here. Thanks much,
>
> Doug
>
>
> ======================================
> The Vision Egg mailing list
> Archives: http://www.freelists.org/archives/visionegg
> Website: http://www.visionegg.org/mailinglist.html
>



--
Simeon H.K. Fitch, Owner
Mustard Seed Software
1634 Brandywine Drive
Charlottesville, VA  22901
210.867.1616

Other related posts: