I’m working on a cross-platform OpenGL project for Windows, Mac, and Linux. I need a simple 2D graphics library. Cairo looks promising but I’m not sure about the best way to use it with OpenGL.
I’ve been creating an image context and swapping the surface on a texture. But is there a faster or more efficient method? I heard about cairo-gl context but couldn’t find much info. Is it stable? Where can I find good docs?
I tried compiling Cairo with GL support on my Mac (OS X 10.10) but ran into issues. Has anyone successfully used cairo-gl? What’s the most reliable and speedy way to combine Cairo and OpenGL across different platforms?
Any tips or experiences would be really helpful. Thanks!
ooh, interesting project! have u considered using skia? it’s pretty slick for 2d graphics and plays nice with opengl. what kinda performance are u aiming for? i’m curious about ur specific use case - might help narrow down the best approach. wanna share more details about ur project?
In my experience, integrating Cairo with OpenGL for cross-platform development can be challenging. While Cairo-GL offers potential performance benefits, its stability and cross-platform support are indeed questionable. For a reliable solution, I’ve found success using Cairo’s image surface approach, albeit with some performance trade-offs. To optimize, consider rendering only when necessary and using texture atlases to minimize state changes. Additionally, exploring hardware-accelerated alternatives like Skia or Qt’s QPainter might be worthwhile for your specific use case. These libraries often provide better performance and smoother integration with OpenGL across different platforms.
hey i been using cairo with opengl. i found using an image surface and uploading as texture works well—though not super fast. cairo-gl is kinda fussy on mac so if you need speed try nanovg, its easer to set up.