On Jun 14, 2008, at 9:06 PM, Peter Clifton wrote:

> This is generally a bit crufty, but for your amusement, see the  
> attached
> patch. It breaks drawing the mask layer, cursor and rubber-band lines,
> but is a stab at making PCB render (translucent drawing) with GL.
>
> Its frame-rate on my complex power controller board at minimum zoom is
> about 2.4 frames per second. This basically matches the frame-rate  
> of my
> similarly crufty test implementation with cairo.

I do not at all have the time to try to put together a build  
environment for this (I've been using the Motif version on Solaris).  
If someone had notes on what all I'd have to install to be able to  
build it, I might get around to trying it.

However, reviewing the patch (applying the patch and reviewing that  
would probably be better still), I have a few suggestions that may  
help speed.  Some of these suggestions may only help specific chips,  
and they may all be outdated for the latest and greatest hardware.

First, in ghid_draw_line, you are setting the shademodel and the  
material attributes and setting up  light and doing some enables.   
These only need to be done if you have turned them off elsewhere.  I  
don't see anyplace that you disable GL_LIGHTING, GL_LIGHT0, or  
GL_DEPTH_TEST, so you don't need to do the enable every single line.   
Likewise with the shade model, material attributes, and light.  Your  
OpenGL may be smart enough to not make unneeded state changes, but  
doing the check will still waste some performance.  Also, I could be  
wrong, but I don't think you need to reinit gobj every time.

Second, don't use glVertex3f when you can use glVertext2f.  This will  
at least help the C performance even if it doesn't make a difference  
to your graphics card.  That said, I suspect that while an Nvidia  
card always does a 3D transform, the OpenGL library for Intel  
graphics may be smart enough to only do 2D transforms sometimes.

Third, if you want a spinning 3D view, make that a special mode.   
Otherwise, turn off lighting and depth testing. That will especially  
help performance on platforms with a CPU transform system.

After those things, if you really want to make it fast, you need to  
drastically change the line drawing methods. To my understanding, a  
lot of what is contained in this:
http://developer.apple.com/graphicsimaging/opengl/optimizingdata.html
will apply to most platforms.  They mention vertex buffer objects,  
that I think that may not be the most backwards compatible, but I  
don't know how far back you want to support.  Personally, I like to  
keep 1.2 supported as much as I can.  I'd hold out for 1.0, but  
working with textures in 1.0 is too painful.


_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to