Where to start with graphics (Windows)?

Started by
5 comments, last by counterrabbit 18 years, 8 months ago
I have been working with MFC and Visual C++ for a few years now. Mostlly I write components and controls for real-time data acquisition. I would like to be able to write some visualization tools as well. Mostly I work in 2D, sometimes I might need 3D though. So I am looking into learning more about graphics in Windows. I looked around, and it seems there are three major libraries I can work from. The problem is that I can't seem to find a real evaluation of which is best for what I need. It seems to break down into flame wars when I read about them. * GDI (for 2D only) * DirectX (DirectDraw for 2D, Direct3D for 3D) * OpenGL My programs will not be full screen 3D, but I would like to have a drawing area in a CFormView. Which one of these techs is best for what I need to do? I am concerned about the speed of drawing. Ah, almost forgot, my apps don't run on XEON workstations with FireGL cards or fast ATI/nVidia cards. My apps mostly run on laptop PCs with Pentium-M chips and standard graphics chips. If I do 3D, it won't be anything too heavy, but I am just curious, is DirectX heavier than OpenGL, or vice versa? Thanks for your input.
Advertisement
I would say start with SDL or openGL.
Thank you for mentioning SDL, I had no clue it even existed. It looks like it is for...cross-platform development I guess? Is it possible to use it within a small window of a larger application?

-------------------------------
| |
| <BUTTON> ----------- |
| <BUTTON> | 2D-3D | |
| <BUTTON> | Graph | |
| < ETC > | | |
| ----------- |
| |
-------------------------------


I looked at some of the code, and it would seem that SDL provides a layer of abstraction so that one doesn't have to deal with MFC or Windows programming. Is this the case?

Is there any particular reason you suggest OpenGL over Direct3D? Does it run better on notebook computers that have less powerful video chips?
OpenGL is cross-platform, which gives it a big advantage over DirectX IMO.
SDL is a fairly low level abstraction of video hardware under almost any OS, and is a good choice for 2d graphical apps. However, it lacks several basic functions like text and primitive drawing that you might find in another library or OpenGL.

You can even combine the 2 and use OpenGL in an SDL window, to provide a cross platform canvas for OpenGL display. There are a couple of relevant tutorials at My Website
Hmmm, so, inside of a regular Windows application (with buttons, text boxes, radio buttons, a menu bar, etc), I could create a part of the app where I could render using SDL and OpenGL? Or does my whole app have to be SDL (and thus giving up all of the windows controls)? I'm talking about a small window inside of the application, maybe 320 by 320 pixels at most. Not a floating window but inside of the CFormView for a windows app. I found some examples of how to do this with OpenGL, but the examples would not compile in Visual Studio 7.
well I'm not sure with directX, but I know that you can, with opengl, get a subwindow and configure it so you can draw into. with win32 api you may use getDC() to get the device context of the window of your choice and then configure it to work with GL. With MFC, i'm not sure but I guess you may have a getDC() method in you CFormView or whatever window you want to draw into.
Tchou kanaky ! tchou !
directx is the way to go, forget direct draw tho as that was dropped and u just use direct 3d now even for 2d . . sounds odd but if you read a book that teaches dx8 you will be given a reason why ddraw was dropped, imo its directx all the way as it is better supported although gl is very well supported but imo come with a lot of over head code that has really no use . . saying that so does dx . . anyway . . choose dx

This topic is closed to new replies.

Advertisement