Cover image for But first let me take a look to the documentation

But first let me take a look to the documentation

lmbarr profile image Luis Miguel ・2 min read

This is an horror story about how to (not) waste 2 weeks of work.

First lemme give you a little bit of context.

I was working on a project where the client asked to create a report that contains images of a certain process. My tech lead asked me to take charge of generating the images, at that time I chose pyopengl (because python was already being used as a programming language in the project) to implement the generation of images in 2D and 3D, mainly because there were already calculated values ​​for the orthogonal camera in Threejs that I would then use in the pyopengl camera.

The process of capturing the images was as follows, first a pygame window is created and then it is drawn on that window to then make a screeshot of it.

So far so good, on my local computer worked well but to try on the server the thing did not work (as I suspected because the server does not have a graphical interface that allows you to create a window to make a capture of that window and save it).

The nightmare starts from here, we looked for a graphics library that allows headless rendering or offscreen rendering for about 2 weeks. First we tried (me and Daniel, the intern that is collaborating in the project) the open3d python package which was a complete disaster because it does not allow to set the camera normally like any graphics library (or maybe it was my fault and I did not find the way), we needed a camera that allows to set the lookup vector, the position vector and the up vector of the camera.

Then, I do not know why, I decided to read the pyopengl documentation and said that it allows headless rendering using the osmesa library (it was not quite explicit though), wait what, it was a facepalm moment combined with a blow mind moment.

After reading that I think it took an hour for Daniel and me to implement and adapt that idea to our code.

So I'll leave with this: Read the documentation of the technology you are already using.


Editor guide
pgrab86 profile image
Paweł Grabowski

Yeah. I remember my first project on Laravel. Had some issue that I googled a lot...tried a couple common responds but it wasn't working. Wasted few hours and then I looked into documentation...15 minutes later my issue has gone. Sooo yes, read the documentation!