LibreCAD 3 OpenGL Rendering – GSoC “Phase 3”

Finally our Tank Fires

“Major Challenges finished”
During Phase 2 the most hard challenges were accomplished. Which required a lot of research and finding multiple ways to implement them. Mentors kept patience and belief in me and gave me opportunity to work on my pace.
The major challenges finished till now were-
–> Thicklines
–> Shader based thick polyline with mitter joints
–> Shader based Dash-Gap linepatterns

“We need to write some Text”
This was the major work to be done as phase 3 starts.
Getting a simple string to render on screen is quite difficult with a low-level library like OpenGL. In LibreCAD there is no limit for characters and extended characters are used often for like mathematical expressions.
Once you think about all these complicated matters of text, it wouldn’t surprise you that this probably doesn’t belong in a low-level API like OpenGL.

“Going with Textures”
So the basic idea behind text rendering is to store the textures corresponding to each character and also its information of coordinates and dimension.(Collectively known as glyphs ) . Not only this glyph data , my idea extended to even cache them as vertex buffer in GPU along with texture. This will not require to generate them at each frame and i just used matrix translations to render them at the perfect position.
And to generate the texture i used the Freetype library. FreeType is a software development library that is able to load fonts, render them to bitmaps and provide support for several font-related operations.
Finally we got nice font rendering with extended characters too.

“Rendering curves”
Now it was time to finish some missing functionalities of the opengl painter which includes curves, bezier , quadratic , cubic , ellipse etc.
As the core part was already done adding these functionalities on the topmost layer was not that hard , it required some mathematics though.

Bezier , quadratic , cubic ,ellipse curves

“Testing before Integration”
So now the painter was ready and it was time for cleaning code, following standards, code refactoring, unit testing etc.
Initially there were some issues on building against the Travis CI , but Florian helped me a lot in this. The code was building successfully.
The OpenGL Rendering works fine.
Overall during the last phase my learning curve got higher. I came across different things, from very simple to hard, how code is made standard, using tools like Travis ,CodeFactor
My Mentors really helped me in learning these things and use them.

“What happening after this”the work left
Me and Florian are working to make code more cleaned , abstracting some parts ,following some standards, removing code duplication , code refactoring.
These are small but important things .
After that there is more work like user defined textures ,MSDF font rendering(if needed) etc.

1 thought on “LibreCAD 3 OpenGL Rendering – GSoC “Phase 3”

  1. Pingback: LibreCAD 3 “OpenGL Rendering” – GSoC 2019 Final Report | LibreCAD

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.