I have used cmake for a couple of years with my hobby projects, and I love it. It is a cross platform meta build system. Like with Qt, people tend to first think that “cross platform” is the main feature. But like with Qt it’s actually one great feature amongst many others. It brings so many advantages that I can’t even list them all here. Since last week, we also use it for PointLine at work. While the process is straightforward on linux, there are some things worth mentioning when using it on Windows.
Finding External libraries
Cmake has lots of finder scripts for commonly used libraries, and they work great in most cases. But we want to have multiple versions of the same libraries side by side, and depending on the version of PointLine we develop for, use the appropriate versions of the libraries. To be precise, not just the libraries, but also the headers and debug symbols need to be present in different versions. And we want to be able to debug different versions of our product using different versions of the libraries, simultaneously on the same machine. Continue reading “cmake with MSVC”
The codebase of our PointLine CAD is certainly quite large. sloccount calculated roughly 770’000 lines of C++ code. I know, this is not a very good metric to describe a project, but it gives an idea. Over time the compile time steadily increased. Of course we also added a lot of new stuff to the product. We also used advanced techniques to reduce the risk of bugs, that have to be paid with compile time. But still, the increase was disproportionate. We mitigated it by using IncrediBuild. Just like distcc, it distributes the compilation load across different machines on the LAN. If I’m lucky, I get about 20 cores compiling for me.
About once a year, one of us does some compile time optimization and tunes the precompiled headers. I did so about three years ago, and then this week it was my turn again. Reading what I could find about precompiled headers on the internet and applying that, I could get only a small speedup, roughly 10%. So I cleaned up the physical structure of the codebase. Here are some things I performed: Continue reading “Optimizing compile time of a large C++ project”
Just like OpenGL and most rendering engines that I know of, WebGL has no builtin support for text rendering. And on top of that, I can’t use the approach we use in PointLine at the moment. PointLine gets the outlines for the characters from the Windows GDI. So I was looking for something cross platform.
Searching on the internet there are two main approaches:
- Render the alphabet or the word in question to an image, and then use that image to texture some triangles.
- Trace the outlines of the characters and triangulate the polygons.
Although I prefer the second approach, I found an example of the first that looked simple enough on nehe. It was based on FreeType and for OpenGL. I started converting it to WebGL, but it was not as easy as it looked. It makes heavy use of display lists which are not available in WebGL.
So I looked further, and found the FTGL library which is also based on FreeType. It sounded like just what I need, but for OpenGL. So, I extended the library to allow me to extract the triangles for processing in WebGL. I sent my patch to the FTGL developers and hope for inclusion.
Meanwhile I can render texts in WebGL with my modified version of FTGL … of course it’s only so easy to do when using Wt::WGLWidget from the excellent witty library.
Here is my research prototype which now has text.
Here are the important parts of how it’s done with the modified libftgl:
Continue reading “Rendering Text in WebGL”
Google employees can spend 20% of their working time for their own projects. We at cubx (The CAD development department recently split from BORM) have now something similar. We get to spend every second friday afternoon for some projects of our own. The only restriction is that it has to do with computer graphics.
I chose a project that I had in mind for almost as long as I have been working for BORM. I wanted to run PointLine as a web service on a linux box. Wit the old core, that was so tightly tied to MFC, this would have been impossible. But the new unfinished core is designed to be platform independent. So, I took it as a base.
Some three years ago, I looked at vrml and x3d for the 3d in browser part. These standards didn’t have as broad support as I thought. You couldn’t do much without buying proprietary browser plugins. So I never made much progress on that. But then came WebGL. All mayor Browsers support it natively, and on top of that, my favourite web application framework recently got a WebGl widget.
So far, my research prototype doesn’t do much, but I already learned a lot that I can also use in my everyday work. I gained a better understanding of rendering pipelines, learned about shaders and ray picking …
As a side project, I set up a jenkins continous integration server that compiles the project on ubuntu and windows after every commit. Additionally, I learned about CPack, so that the result of the jenkins build is a binary deb package ready to install.
You can see the web application as it progresses here:
Usually, I would also provide a link to the sources, but this is closed source, sorry…
Last year, I spent some time rewriting internals of how groups are handled in our CAD software. Before that, groups were just to help with the selection of elements that belong together. The grouping was only one level deep, and the elements were organized flat on the document. All the calling functions had to uptate the relationships in the pointers and containers which were publicly available. This was a constant source of bugs and completely unsuitable for nested symbols that we wanted to import.
Continue reading “Propagate deletion of C++ Objects”