Tips/resources for creating abstracted OpenGL render queue?

I’m slowly working on an OpenGL 3d engine and I thought I’d look into render queues before continuing with my gui development.

I think I want to implement a queue that would accept render primitives such as quads, triangles and state changes (and more). Primitives would include all of the information required to render them, including material, colour, blending etc…

One of the reasons I want to do this, is that I have several DLLs in my engine. The Render DLL takes care of Window and GUI management. The Game DLL will contain game objects that need to be rendered. I want to see if I can avoid storing OpenGL rendering operations inside the Game DLL; hence the queue. ALso, I figured that if I sorted the render queue by materials (for example) I may achieve slight performance improvements.

Does anyone know of some good starting resources for learning how to implement a render queue? Or does anyone have some good tips?

Thanks

Maybe this is what you’re after: http://www.delphi3d.net/articles/viewarticle.php?article=stateman.htm

-Ilkka