Professional use of OpenGL -> Some help here..

Hello Experts,

I am totally new to the whole OpenGl & C++ World, so forgive me for maybe silly questions.
The background is that I have searched the web for days but found nothing out. To me personally: I am an professional programmer in other languages (Delphi, Perl, etc.) and have now to start a big project that should have as a result a good vector library and should be runable on Windows XP/2000, Win CE(.net) and Linux.
Okay, so I’d thought (hu, came never out of the windows environment…) I have to use C++.
Then I’ve searched for a graphic lib to start and I think opengl is the best (I also looked at SDL).

I hope someone could answer these small questions which would help for a start:

  • OpenGL can be easily used for a 2D-Drawing application, right? I mean, I don’t need any special hardware like directx which wouldn’t be ideal for 2d vector programming.

  • Does OpenGl run on Win XP/00, CE and Linux?

  • Can 2D and 3D be combined? (As far as I found out, OpenGL is always 3D, 2D=3D-Z)

  • Can OpenGL antialiase my shapes? I saw that lines and points are possible but I need to have all my shapes antialiased, just as the M$ GDI+ Library does.

  • How can I draw complex pathes? I have searched for something like a “Path-Element” onto which I can draw different shapes like rect, lines, polys and more… after the path is ready I want to draw and fill it…

  • How can transparency easily archivied? For comparison: In GDI+ I simply have a 32bit color with included alpha and when I draw anything with that color on my HDC, it is blended to the rest

  • VERY important: Is OpenGL fast? Say I have to render huge, really huge Maps or CAD-Drawings in the fastest time as possible… And also, these things must be additionally animated.

  • How can I draw linear and radial gradients?

  • How can I paint one or more Bézier Curves?

Okay, these were my most important questions for now, I really hope someone can help me here…

A last thing: Are there any sources or applications (free, commercial, etc.) out there that are a kind of a Vector Application based on OpenGL as I want to do?
And: Is there maybe already any library out that does some of the things with OpenGL I want to do? I searched but found nothing.

1000’s thanks,
Alex

First, absolutely the best place to get started with OpenGL is the OpenGL FAQ (though it needs to updated). The best place to find tutorials is NeHe .

* OpenGL can be easily used for a 2D-Drawing application, right? I mean, I don’t need any special hardware like directx which wouldn’t be ideal for 2d vector programming.

Yes, but… OpenGL doesn’t have a lot of the 2D features you are looking for.

* Does OpenGl run on Win XP/00, CE and Linux?

98, XP, 2000: yes
CE: no (AFAIK)
Linux: yes

* Can 2D and 3D be combined?

Yes. OpenGL is always 3D, 2D=3D-Z

* Can OpenGL antialiase my shapes?

AFAIK, that would be in the realm of OpenGL extensions which are hardware-specific.

* How can I draw complex pathes?

OpenGL does not have “paths” and cannot “fill”, but you could implement those functions using OpenGL.

* How can transparency easily archivied?

OpenGL supports many color formats including those with alpha. It has many blending modes.

* VERY important: Is OpenGL fast?

OpenGL is fast. The hardware/drivers and your code have more impact on rendering performance than OpenGL.

* How can I draw linear and radial gradients?

Using vertex colors will not work. You can render a texture with the gradient you want, and then use that texture when drawing your shapes.

* How can I paint one or more Bézier Curves?

Look at “evaluators”.

If you have professional OpenGL hardware and drivers then you’ll get anti-aliased shapes MUCH faster than GDI+. But only a small proportion of users have professional boards, like Nvidia Quadro or ATI FireGL series. Of course, you can use FSAA to further smooth the shapes, but if your device is not supporting hardware acceleration for anti-aliasing, than the rendering will be done software, much slower.

opengl is very often the api at hand for graphics purposes.

Antialiasing can be done via the accumulation buffer. there are many papers on that topic. thus you don’t need any “special” hardware just a graphics board that is capable of opengl and most of them are

Mmh… any more words on the antialias thing?
I must have a graphic-engine that works on every sytem, GDI+ also works, so no way about any special hardware for this…

Another thing: How to draw Gradients as Textures and the fill something with it?
and: How to create such pathes as I’ve written?
What about Béziers?

I cannot imagine that there’s isn’t any good 2d-lib or something similar for OpenGl out there…

Btw.: What would you say to use for Win CE when opengl is not available there(?) and all should be build out from one source…

Alex

ah… forgot: Just have read in the faq about the ‘evaluators’. What is this? There is only that you can draw béziers with it, but how?

Alex

In the same way that you draw beziers in Delphi but you have much more control over the curve drawing. How much control do you want over your gradient fill’s? texture mappng may not be that dynamic.

You can indeed use the accumulation buffer to achieve antialiasing, by drawing several times the scene - with small jitters - and averaging. But this way it’s not as correct as the primitive antialising, and it has been superceded by the multisampling, which I think it’s also faster for FSAA. Unfortunately, to have line antialising done
in hardware, you need a profesional board, or to tweak the drivers (if possible).
Regarding the drawing of very large line strips, I only tested upto 4 million vertexes, without the need to split the “path” like in GDI, and got linear performance scaling.