Solved

C++ and graphics libraries

Posted on 2004-08-02
10
427 Views
Last Modified: 2010-04-01
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
Comment
Question by:Schmapper
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 5

Accepted Solution

by:
lwinkenb earned 400 total points
ID: 11700888
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
 

Expert Comment

by:aakash_mandhar
ID: 11703419
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
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 100 total points
ID: 11705376
If you use opengl, you will be prepared to easily migrate to Unix too, so I guess it is the best choice.
0
 

Author Comment

by:Schmapper
ID: 11710844
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
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 100 total points
ID: 11710959
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Schmapper
ID: 11711226
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
 
LVL 5

Assisted Solution

by:lwinkenb
lwinkenb earned 400 total points
ID: 11711302
"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
 
LVL 5

Assisted Solution

by:lwinkenb
lwinkenb earned 400 total points
ID: 11711323
"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
 
LVL 16

Expert Comment

by:George Tokas
ID: 11736269
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
 

Author Comment

by:Schmapper
ID: 11745304
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now