← Back to team overview

kicad-developers team mailing list archive

Re: Text in opengl

 

On 02/24/2014 08:45 AM, Lorenzo Marcantonio wrote:
- 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!)

It is not that text should generate identical vertices, the purpose is to separate lines stored in a single VBO. If you have a VBO drawn as GL_LINE_STRIP, then you will have *all* vertices drawn as a single continous line, so you need a way to tell GPU that there should be a break. It is better explained here (for triangles), chapter "Use Triangle Strips to Batch Vertex Data":
https://developer.apple.com/library/ios/DOCUMENTATION/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html

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

a) Why do you think so? It is just one black & white texture containing all characters (e.g. http://i.stack.imgur.com/VFKM2.gif) and then it is simply referred to when drawing characters. Textures can also be colorized, so the bitmap black & white is perfectly fine. b) Maybe there are some ways to sharpen textures, but I am not very familiar with the topic.

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

But for lines made from triangles it works http://oi58.tinypic.com/21n2s1j.jpg (yup, it is buggy, there is something wrong and currently I do not know how to fix it).

Regards,
Orson


Follow ups

References