tags:

views:

926

answers:

4

Requirements:

  • Retained graphics mode API
  • For 2D objects only (though 3D transforms of these 2D objects is of interest)
  • Cross-platform
  • Vector graphics drawing
  • Raster compositing + support for opacity masks - hardware accelerated of course...
  • Animation API
  • Package size - can it run in an embedded environment?

This is not for a game, but I am not opposed to using a game type API.

Some thoughts:

Qt is probably too heavy-weight, but I am not familiar enough with the API to know if it would meet the requirements. I am not interested in Qts window management (there are no windows) or widget / control set as it is not for a desktop type application. Also, I am not sure if Qt has an animation framework? Thoughts here?

Most likely what this would be is a framework built on top of OpenGL. I just don't know if such a thing exists. Also, I am unclear about 2D graphics in OpenGL. Are 2D graphics truly 2D or are they simply 3D objects drawn on a plane oriented to look 2D?

WPF is to DirectX as _________ is to OpenGL

If the blank can be filled that is what I am looking for.

Update #2

I spent some time this weekend with Qt and have discovered QGraphicsScene class - which seems to be the fundamental class for Qt's 2D retained type graphics mode - and QGraphicsWidget which allows some auto-layout functionality of the QWidget class.

Qt is close to passing my litmus test. One final thing to figure out is a good designer to developer workflow when dealing with Vector images, i.e., how do I take an icon created in Illustrator and turn that into a QGraphicsItem - this might be a good candidate for a new (more focused) question.

+3  A: 

You might want to check out Cairo, it has an OpenGL backend. I don't think it has an animation API though.

codelogic
Wow. I am impressed with the clarity of the Cairo rendering as seen on their website. However, it seems their roadmap does not align with the goals of my project. I am not interested in quality PDF output or printing. Pure unadulterated 2D speed with smooth animations is what I am after.
helifreak
Cairo can also be used for animated rendering. Check out the videos on this page: http://www.cairographics.org/OpenGL/
codelogic
+1  A: 

While OpenGL is a great tool for 3D rendering it is important to understand that at the end of the day the output medium is inherently 2D. Perceptions of the 3rd dimension is achieved through visual clues such as lighting, far object appearing smaller then near objects, and near objects occluding far objects.

These visual clues are implemented as computations at various stages of the graphics pipeline. Lighting and shading, viewport transforms, and depth queries are some of the operations used to create the illusion of 3D.

When using OpenGL for 2D, many of the pipeline operations typically used for 3D rendering can be ignored. This can result in performance improvements due to reduced computation and has the added benefit of simplifying the source code. There are also a number of operations that work specifically on a 2d raster such as drawing sprites.

Instead of thinking about 2D rendering as a reduced set of 3D rendering, I would encourage you to consider 3D rendering as the result of carefully constructed 2D elements.

Marc
A: 

WPF is also 3D. The library is tuned and designed to make 2D easy, but it has all the 3D transformations in there as well.

Orion Adrian
Yes, I probably should have been more clear. 3D transformations of 2D objects is of interest (usually referred to as 2.5D), however I am not interested in 3D objects. I would be happy with a 4x4 matrix that could be applied to any 2D object.
helifreak
+2  A: 

As to using Qt.

It's not heavy-weight in any meaningful sense. The dynamic library is a few megs and the graphic operations are quite optimized I believe.

It does not have a stable version using OpenGL acceleration -- this is coming in Qt4.5.

It does use XRender or something, for 2D accel

Also it has a great drawing API, and an animation API (QTimeLine for simple things and recently the more powerful QtAnimation)

So what I meant be heavy-weight could be just a perception problem I have with Qt - and I guess I need to understand more of its modular nature, but I have no interest in Qts windowing/X11 features, or its long list of widgets/controls that come with Qt.
helifreak
its a question of useless minimalism. Qt has a bunch of stuff, widgets, networking, xml, everything you may need. If you don't need it don't use it, theres no point fretting over it.