← Back to team overview

kicad-developers team mailing list archive

Re: Re: wxDC & wxGraphicsContext Test

 

Torsten Hüter wrote:
> Hi Marco,
> 
>> We have already a GAL, wxGC does this work: is an astraction layer nothing
>> more nothing less.
> 
> This abstraction depends on wxWidgets and is maintained not by KiCad developers. What's needed is an abstraction for KiCad itself, that is *independent* of wxWidgets. Thus porting to other graphics backends is much easier. To a certain degree gr_basic covers already many functions, however it's not object oriented.

Torsten,

It shouldn't be too difficult (famous last words) to create a base
drawing class ( say KicadGraphicsBase ) similar in design to wxDCBase
and then the initial implementation would just be an object oriented
version of our current drawing functions in gr_basic. Once that is
done, you could conceivably create a version based on OpenGL, SFML, etc.
You would also need to create a new canvas (WinEDA_DrawPanel) class to
take advantage of these graphics libraries. I am will to take a stab at
it after the next version of Kicad is released.

>>> Cairo and wxGC have approx. the same drawing speed; OpenGL is much
>> faster than both. 
>>
>> wxGC is CAIRO on Linux, just remapped calls :)
>> We have to see if is possible enable OpenGL backend in cairo.
> 
> I've changed my implementation a little bit, now I'm using ctime and calculate the frame rate. The results are now more realistic - I'm getting on my system for wxGC 0.55 frames/s, wx + Cairo 0.8 frames/s and OpenGL (wxGLCanvas) 50 frames/s.
> The direct calling of Cairo seems to be a slightly bit faster. In my opinion for the developer it's perhaps even easier to use Cairo directly - also it offers more functions than wxGC (which is basically a wrapper).
> 
> Yesterday I've compiled the benchmark for wxWidgets + Cairo under Windows - was pretty easy.

Thanks for taking the time to look at this.

> 
> --
> 
> OpenGL is the hottest candidate if it should be *fast*. Most KiCad graphic primitives are lines, then circles, arcs - circles are easy to draw (with gluDisc), arcs need perhaps our own implementation.
> In my opinion a pure OpenGL variant should be considered; already the 3D view of KiCad is faster than the wxGC main screen.

Using OpenGL is not a bad idea. I always tend to think about OpenGL as
a 3D rendering library but that is not it's only purpose. The only
problem may be is how much of OpenGL is implemented on each platform.
The current 3D frame doesn't seem to have any issues ( not sure about
the MAC ) so I don't see any problem using it for 2D rendering. It
could be used in some interesting ways in PCBNew. It might be useful to
switch between 2D and 3D while laying out a PCB.

Wayne

> 
> Bye..
> Torsten


 




References