OpenGL excels in its 3D real-time rendering capabilities.
It also offers many features which are highly desirable for 2D graphical applications, e.g. hardware-assisted double buffering, antialiasing, texturing and blending. These things simply aren’t found in the 2D APIs out there (XLib, QuickDraw, GDI, etc.) and writing 2D apps which do efficient double buffering, texturing and blending is a huge problem for developers.
Unfortunately, OpenGL’s commitment to 2D graphics is half hearted. For example, it does not provide a wide range of line styles, or support self-intersecting 2D polygons, or offer a standard set of outline fonts, or offer good support for indexed-mode images. Furthermore, the same rendering calls produce different results on different platforms, which can be problematic for 2D apps. And some things just look bad - for example, translucent thick lines in OpenGL have ugly artifacts at the joints between segments.
I’ve spoken to several OpenGL advocates about this. The response is always that these things are easy to work around by writing code which converts the 2D geometry (thick lines, fonts, polygons, etc) into triangles and quads, and rendering those. [Not only is this not “easy”, it also limits opportunities for hardware acceleration of standard 2D operations.]
I challenge all you OpenGL advocates out there to:
Provide a standard utility library for using OpenGL in 2D apps.
Offer ways for OpenGL vendors to provide access to hardware acceleration for 2D operations as well as 3D ops.
Offer better guidelines regarding rendering accuracy for 2D graphics
Provide clearer guidelines regarding mixed-mode rendering, whereby applications use both GDI (or Xlib or QuickDraw) and OpenGL together in a single window.
The OpenGL 2D Utility library must at least include support for:
* 2D thick-line styles, such as miters and bevels. * proper translucency for thick lines * support for concave/complex self-intersecting flat 2D polygons with even-odd and non-zero winding rules * A collection of standard outline fonts * Bezier curves and Bezier filled shapes
A good test case would be to make an OpenGL implementation of the Java2D graphics API (what a great combo!)
If the OpenGL standard was extended to better support 2D graphics, I believe that the win for OpenGL is huge. OpenGL usage would grow significantly - OpenGL would quite possible become -the- standard cross-platform graphics API for both 2D and 3D graphics.
I hope it makes it.