2D Interactive Graphics

I would need some pointers how to do 2D interactive graphics using OpenGL. It would be quite simple, I only need to be able to draw scalable symbols which could be dragged or clicked with a mouse.
Is OpenGL suitable for this or should I look elsewhere ?


Hi !

Yes you can use OpenGL for this, not sure if it is the best tool for it but that’s up to you.

If you look at the FAQ’s on this website you will find information on how to setup the matrices to map 1:1 to the pixels, but it’s also very easy to change the scale of each “symbol”

The limitation you get with OpenGL is that it’s very easy to draw points, lines and triangles, but if you need for example a circle or an arc you have to create it yourself with short line segments or use splines/nurbs.

Another thing is if you for example want to draw a box with a border in another color you will have to draw the box twice.

A positive thing with OpenGL is that it is very good when it comes to drawing transparent shapes, there are also lots of neat effects that can be done with OpenGL.

And of course, OpenGL has good texture support that allows you to map an image to a shape.

I guess you need to look into what kind of features you want and compare this to what OpenGL has to offer compared to using a native 2D library (GDI/GDI+ on Windows).