Toolsets and Opengl

I hope this is the right place for the subject. That said:
I still have some trouble in the understanding of what toolsets and canvas are and what incidence openGL has over them.
I read this FAQ: Pcb_new: What is a canvas? (default [legacy], open-gl [accelerated] and cairo [fallback]) Is there a difference? but I’m still confusing.
The reason of this message:
I recently upgraded Camotics from ver 1.06 to ver 1.20. Although OpenGL version was 3.1 on my system, Camotics was claiming to upgrade it at least to ver 2.0. In consequence I upgraded my graphic driver.
Unfortunately this wasn’t enough: still the same error message. After searching the web and asking the developper, I ended with the creation of a new environment variable: QT_OPENGL=desktop.
The problem is that I did this without any understanding of what OpenGL and QT_OpenGL are. I read some related papers, unfortunately they added lots of trouble instead !

First: my skills being very low regarding this matter, if somebody might provide me with an orientation or a link to some sort of OpenGL guide for dummies, he will be welcome.
Second: more precisely i’d like to know if this variable in its desktop, angle, software or es2 values has an impact on pcbnew with the modern toolset.


OpenGL is a graphics abstraction layer. In early days of accelerated graphics cards when they were still called AGPs and you would insert them into ISA slot every manufacturer would write their drivers however they wanted and then every game of application developer had to adapt their code to specific graphics cards or model series.
Eventually someone came up with an idea to bring some structure to this chaos and make a standard API that graphics manufacturers drivers had to support and that would make it easy for app and game developers to use graphics subsystem of a PC regardless of the underlying hardware.
That effort would eventually become OpenGL. Microsoft, of course, in it’s infinite wisdom, developed a competing DirectX which served the same purpose of middle layer. At least it had some advantages over OpenGL and handled more than just graphics so it wasn’t a waste of everyone’s time.

Anyway, back to kicad, there are currently two methods of drawing the schematic and board on your screen implemented in the app. Using accelerated canvas, which relies on OpenGL (it’s called accelerated because it uses hardware acceleration) and software fallback or cairo canvas, which works on any potato as long as it’s an x86 potato, regardless of graphics.
You can forget about the third, legacy method. It’s gone in v6, even in v5.1 on linux.

Regarding QT_OPENGL=desktop, that would have no effect on kicad as kicad doesn’t use QT at all.
As far as I understand you are having issues with Camotics, not kicad.
Quick googling also found this comment on a related issue
I’m far out of my area of expertise here but looks like QT_OPENGL set to desktop switches QT to use normal opengl while QT_OPENGL=angle uses OpenGL ES which is a subset of OpenGL API that is designed to be more compatible with embedded devices, phones, tablets and other kitchen appliances. Normal desktop software might not work with OpenGL ES, as seems to be the case with Camotics.

ANGLE (Almost Native Graphics Layer Engine) is an open source project by Google. Its aim is to map OpenGL ES 2.0 API calls to DirectX 9 API.

To add: a reasonable question may arise, why do developers in general (and kicad team in particular) bother with supporting 2 rendering methods in the first place? It’s almost twice the work after all.

Well, using hardware acceleration is a must for complex designs where there are a lots of elements that need to be drawn on the screen (think 10s of thousands polygons). Without hardware acceleration zooming and panning or doing anything on such a board would slow down to a crawl even on machines with most powerful CPUs. CPUs are not designed to do a lot of simple things, they are designed to do a few very complex things. GPUs are the opposite, they are perfect for doing lots of relatively simple things, they can render 10k polygons in milliseconds without breaking a sweat.

So why software fallback then? For wider compatibility. Even though all PC hardware manufactured in the last 20 years supports OpenGL 2.1 or whatever version is required by kicad, not all drivers work well and not everyone even uses a PC.

Did you try to add a screenshot? I don’t see any error message which “the same” would refer to. Do you have a problem with using KiCad?

The reason for the second fall back canvas is broken openGL drivers in some PCs, even recent ones. The performance us hit hard, but at least it works

… and when I use my OLD netbook to view a project while soldering or just show it around I am happy to have the slow alternative !

Kind of funny you mention this to qu1ck. He’s the author of the excellent Interactive BOM plugin. This plugin creates a DHTML file that you can transfer to your netbook and use its broswer to assist you assembling your boards. See the homepage for that plugin here:

1 Like

Thank you for this hint. I really should try that with my weakly eeePC that serves as an USB-Scope running Bodhi Linux… :thinking:

Nostalgia mode: I remember, in the past I installed ORCad on an XT + CGA display then moved to an AT with an EGA monitor, drivers needed to be configured depending on the application, the hardware and lot of other parameters. What a pain !

Thank you guys for your prominent explanations. However, I can’t manage to perceive well what QT is regarding OpenGL. Please, correct me. My understanding is that OpenGL is low level object oriented that needs intensive computing and the power of a GPU to render them. QT is rather a library collection of complex objects that can be manipulated with less resources (eg. a CPU) but can be supported by OpenGL as well when necessary. To get full benefit of the acceleration, the variable QT_OpenGl=desktop is set and these objects are no longer manipulated by Qt but by OpenGL instead.

@qu1ck: The Cauldron’s document you pointed out is precisely the discussion that lead me to put the variable in my environment. I can deduce that Camotics doesn’t use QT. What I don’t understand is why the variable was necessary. In other words my system wasn’t using OpenGL acceleration by default.

One question remains: although the purpose is understood, the word “canvas” is still mysterious for me. What does it refer to: the displayed object, the current work under processing, something else ?
Same question for the word “toolset” is it a synonym of canvas for kicad ?

@eelik: Here’s the error message: image
It belongs to Camotics when the QT variable wasn’t set
No issue with kicad, just some concerns because my lack of understanding.

Thanks again for your help.

QT is a graphical user interface library. It is responsible for drawing buttons, textboxes and other UI elements of the application. Some features of it may rely on OpenGL and it generally sits higher in the software stack.

it does

Canvas is a generic term that means pretty much what it means in common English: drawing space. It’s an area of the screen where programs “paint” whatever they need.
Depending on which software layer the canvas is provided by, the canvas capabilities may vary. OpenGL or Cairo canvas will give you ability to draw lines and polygons. QT or wxWidgets canvas will give you ability to draw UI elements in addition to that.

1 Like

Thanks a lot Qu1cs for these precisions. I feel far better now ! (and it’s really true). I hate situations where I’m wandering in the darkness.
I’m archiving your posts for further reference when needed.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.