Looking for a crate with software rendering implementation of OpenGL

I am using

which provides painting API on top of OpenGL. I'd love to "unit-test" my app by essentially taking screenshots. I think what I need here is a software implementation of OpenGL, so that it can deterministically render my stuff to an image and just compare hashes of the result.

Is there a crate for this?

I don't know of a rust crate, but you could use Mesa's LlvmPipe software OpenGL renderer and if necessary run your program inside xvfb (X virtual framebuffer) to be able to open a window while still running headless.

Bevy roughly does this (except with LavaPipe rather than LlvmPipe for Vulkan support. LavaPipe requires a very new mesa version) Bevy also has some code to handle making screenshots and to read inputs from a file.


Maybe the easiest solution would be to ask the developers of Speedy2D to add an API for getting the raw pixels from a Graphics2D instance? AFAICT, they already have a private API for that (which I assume wraps glReadPixels).


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.