← Back to team overview

kicad-developers team mailing list archive

Re: Text in opengl

 

On Sun, Feb 23, 2014 at 10:01:59PM +0100, Maciej Sumiński wrote:
> Truly they are. Vertex shaders are said to be supported since OpenGL 2.0, so
> fortunately most of current GPUs are compatible.

Oh well even on a TNT2 they are supported... in software :D AFAIK
they're accelerated only from the GMA-X series; not a big issue since
vertex shader are called way less often...

> Assuming that *every* card supports lines wider than 1 pixel, you are still
> limited to available line width range. In my case (integrated Intel GPU),
> http://pastebin.com/86jqj2bV outputs:
> line width range: 1.000000 - 5.000000
> line granularity: 0.500000
> I am afraid you will not get much more on better video cards. As
> transformations do not apply to line width, you can have up to 5 pixel wide
> lines (at least in my case). This may be a problem for copper texts (as you
> rather expect them to apply to WYSIWYG), but should not be a limitation for
> netnames (depends on sight quality).

Ouch. Very *very* ouch. It seems that these days cards are made only to pump
out textured triangles.

It wouldn't surprise then if these thick lines were slow as hell :(((
More research is needed.

> - Handling a VBO for line strips (and probably a shader or some other way of
> controlling line width per line, not for the whole batch). I am not sure if
> degenerated vertices (i.e. two consecutives vertices with the same
> coordinates to indicate beginning of a new line) work in GL_LINE_STRIP mode,
> otherwise you have to use GL_LINE instead.

Text should never generate identical vertices, otherwise font data is
misoptimized :P anyway I don't remember seeing something forbidding them
(but also nothing guaranteeing... so maybe they are implementation
dependant - as usual!)

Using a shader to fix line width should work, but doesn't reduce vertex
count. I hoped to do that. Also I have no idea on how shaders work :P

> - Drawing using direct mode, but in this case all lines should be drawn at
> the same time. Also I wonder how does it compete with current VBO batch in
> terms of performance.
> If I had to choose, I would go for bitmap fonts. It makes every character
> one quad or two triangles. Or maybe antialiasing could solve the problem?

Texturing the font would need a) a huge amount of texture memory (and
Intels are sharing the system memory) and b) losing crispness due to
resampling; I'd prefer the current situation in that case :D

Antialiasing on lines is historically never been implemented on consumer
cards (it was one of the 'differences' of the Quadros), but maybe now
the situation is different. In fact the FireGL we used (still the IBM
design, not the overpowered Radeon) had the 'line' primitives
(evaluators included) completely done in HW, antialiasing and stuff. But
only one texture stage :D

-- 
Lorenzo Marcantonio
Logos Srl


Follow ups

References