I would like to render my overlay opengl (bgl and blf) to images. I know that’s possible because Measure-it addon is able to do it but I have some difficulties to understand the script of the addon.
Does someone can point me the way to get the opengl overlay to pixels? what part of the API should I use?
hi, afaik, measureit is the only addon that does this.
What the op wants is to render his image & have his bgl drawn on top automatically in the render.
Both. Drawing on top of the viewport is quite easy but to render it over an image, I could render a “screenshot” of the viewport and crop the area I want to keep but the problem is that I need to render it over an image that has a higher resolution than my viewport/screen.
That’s probably why the measure-it addon is using tiles to get rid of this problem but it seems quite complex to me.
As a workaround for the moment, to save the opengl overlay on a rendered image, I send all the drawing information (lines and text) to ImageMagick with subprocess (or PILLOW, which is also working) and draw the overlay from there. I feel like I’m doing twice the script but at least it’s working well. Tell me if you have better idea.