• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

C++ and graphics libraries

Hello experts,
This is a general question about the most suitable graphics library for me to use in developing my application. Ideally, the library should be able to support drawing general 2D paths (and filling them when closed) ... by 'general paths', I mean shapes defined as sets of connected lines and curves.

I had originally intended to use GDI+. But now I'm concerned that GDI+ is slow in terms of performance when compared with the original GDI ... is this true (and can anyone give me an idea of how much slower we are talking here)? Also, it states in the GDI+ function documentation that supported platforms are Window Me, Windows XP, Windows 2000, and Windows NT. Does this mean that my application, if GDI+ were used, would not be able to run on Windows 98 (standard edition) and Windows 95 (even if GDI+ was to be linked in statically ... is this possible?)?

Is DirectX a possibility? I think DirectX would have alot more than I require (since I have no 3D requirement), but does it support general path definitions? Also, would a Direct X based solution be runnable on all platforms back to Windows '95.

Are there any other graphics libraries to consider? My ideal set of requirements for the library are (in order of importance):
1) Applications using it should be able to run on all Windows desktop platforms back to Windows 95
2) It should be either capable of being statically linked into the EXE or should be reasonably small as a DLL
3) It should be quick
4) It should support general path drawing and filling (as well as the usual simple 2D lines and shapes)
5) It should support alpha blending

Is there anything out there that gets close to meeting these requirements?
0
Schmapper
Asked:
Schmapper
  • 3
  • 3
  • 2
  • +2
5 Solutions
 
lwinkenbCommented:
opengl or directx.  Both of those libraries meet your set of requirements, and there is a ton of information and tutorials on the web to get you started.  I suggest opengl if you want to use a platform other than windows.

If you choose opengl, head to http://nehe.gamedev.net 
That is where I learned opengl, it has some of the best tutorials on the web.
0
 
aakash_mandharCommented:
Hi... I see what you mean.. You can use GLUT (an open gl library) which is pretty easy to use or could use FASTGRAPH... I would suggest fastgraph as it is very fast.. http://www.fastgraph.com .. It works for me and hope is useful for you...

Regards
Aakash
0
 
Jaime OlivaresCommented:
If you use opengl, you will be prepared to easily migrate to Unix too, so I guess it is the best choice.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SchmapperAuthor Commented:
Thanks for the comments everyone.

I looked at fastgraph, but unless I missed it, I don't think it supports general path definitions, which would make it awkward for me to use.

I'm going to investigate openGL and DirectX. I read somewhere (think it was a thread on EE) that openGL is very slow compared to DirectX (and evenslow compared to GDI). I find this I little hard to believe, since I know it is used by game developers, but is there any truth in the suggestion that openGL is slow?
0
 
Jaime OlivaresCommented:
This paper talks about differences between OpenGL and DirectX (Chapter 4):
http://people.msoe.edu/~barnicks/courses/cs384/papers19992000/Ribble-CS384%20OpenGL%20term%20paper.pdf
Some advanced articles in:
http://www.hardocp.com/

Also consider that DirectX is currently centered in 3D applications, while OpenGL have more 2D support.
0
 
SchmapperAuthor Commented:
Thanks Jaime, that's useful.

Just looked at trying to download DirectX, but it's about 225Mb ... seems like you have to download every part, including all the stuff you don't really want. Anyone know what would need to be distributed (in terms of size) with an application that uses DirectX?

Is it correct that Windows openGL is pre-shipped with the O/S? Does this mean that no additional libraries would need to be shipped with a Windows application that uses openGL?

Also, does anyone out there know the answers to my original GDI+ questions. Namely, can GDI+ be linked statically into an EXE? Can GDI+, if linked statically or shipped as a DLL, be used on Windows versions prior to Window 98 ME? And is GDI+ really as slow as some threads are suggesting. I should say that I would prefer to use GDI+ if feasible, because I have some of the code I require in Java2D, and this maps very easily to GDI+, but would probably not map as easily to openGL or DirectX.
0
 
lwinkenbCommented:
"but is there any truth in the suggestion that openGL is slow?"
Well I find that hard to believe considering the most graphic intensive game released to date (Doom3) was done in opengl.  I programmed with direct3D for over a year before I switched to openGL, and I have not noticed a difference in speeds between the two.

"Also consider that DirectX is currently centered in 3D applications, while OpenGL have more 2D support."
That's just not true at all.  Both openGL and directX support both 2D AND 3D applications.  openGL has libraries for both 2D and 3D.  DirectX includes Direct3D for 3D applications, and DirectDraw for 2D applications.

The best article I've found explaining the difference between the two is at http://www.gamedev.net/reference/articles/article1775.asp

Look at it this way:  You wont be missing out on anything choosing directX over openGL or vise-versa.  Consider the following:

Games programmed using openGL
Quake 1,2 and 3
Doom3
Return to castle wolfenstein
Half life
Unreal
Diablo 2

Games programmed using DirectX
Halo
Half life (notice that it's in the openGL list too)
Unreal (another game which has support for both openGL and direct3d in it's engine)

I switched from directX to openGL for two reasons.  First, openGL syntax is a little easier to read, and similar to C.  DirectX uses COM which can be a little confusing at times.
Also, there seems to be more documentation/tutorials/articles which use openGL rather than DirectX.  Like I said earlier though, you can really go wrong either way (unless your platform is linux of course :) ).  


0
 
lwinkenbCommented:
"Just looked at trying to download DirectX, but it's about 225Mb ... seems like you have to download every part, including all the stuff you don't really want. Anyone know what would need to be distributed (in terms of size) with an application that uses DirectX?"
DirectX includes a lot more than just graphic libraries.  It has DirectDraw and Direct3D which are the graphic libraries.  It has DirectSound (for sound).  DirectInput (handles input for joysticks and stuff).  DirectX probably has other stuff too, I just cant remember.

"Is it correct that Windows openGL is pre-shipped with the O/S? Does this mean that no additional libraries would need to be shipped with a Windows application that uses openGL?"
That is correct.  Keep in mind that is also correct for directX as well though.  The 225Mb download is the directX SDK which is needed to create DirectX applications - not run them.  Although if your directX application uses some of the newest API calls, then you might need the user to upgrade their directX version.

"And is GDI+ really as slow as some threads are suggesting."
Well If I'm not mistaken, GDI is all software rendered.  This is very slow compared to hardware rendering which is what directX and openGL do.  

"I have some of the code I require in Java2D, and this maps very easily to GDI+, but would probably not map as easily to openGL or DirectX."
Im not sure about directX, but java has it's own opengl libraries which you can use.  It might not be as hard as you think to map it to openGL.
0
 
George TokasCommented:
Hello there..
About DirectX a suggection:
There is a wrapper library called CDXLib.
It handles all you otherwise hard code.
Works perfectly with 2D and its fast.
You will find it at http://www.cdxlib.com

gtokas.
0
 
SchmapperAuthor Commented:
Thanks everyone for the answers. I' m trying to do some prototyping with openGL to see if it can do everything that I need (so probably lots more openGL questions coming!).
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now