Has anyone created an OpenGL based LowLevelGraphicsContext?

It would be most helpfull if someone could share with me thier code.
I started implementing it myself but got a bit lost when I got to all the clipping methods.


it would be great to have an hardware accelerated graphics context in Juce.

I didn’t try to do it, but I will help if I can, could you be more specific about the problems you have ?
or let the source somewhere so that anybody can contribute.

The tricky bit is getting opengl to draw anti-aliased polygons…

Anti Aliasing depends on the card you have, and most new cards support it. I think the hard part is filling a complex path, because you have to break it up into triangles in order to fill it.

The same is with complex clipping regions, where you need to create a stencil buffer.

Did you try to use glutesselator to fill the path ?

For Stencil buffer, I started to add an OpenGLPixelFormat option to the OpenGLComponent, so that you can ask for a stencil buffer / AA samples when initializing opengl. However I only had it working on ms windows for now, just ask if you’re interested.

Problem, The font functions and images are calling the LowLevelGraphicsContext DrawImage routines. For OGL I will make a texture and send it to the card and then draw the texture and then delete the texture. This will be inefficient and cause allot of traffic on the bus. We will need a method for holding a reference to the texture so that I wont need to dispose it every time, only when the image changes.

Any thoughts?

My plan was always to extend the image class so that it could be held as a texture, or off-loaded back to main main memory when it’s not been used for a while. All a bit tricky! Sorry I’ve not got much time to help out on this at the moment.