Well I made it through my first semester of an MSCS. Almost. This summer I want to build a game. I am trying to understand a little bit of the history of Windows graphics and am a bit confused. There's WinAPI. There's OpenGL. There's DirectX. As I understand it, OpenGL was initially offered on NT platforms for high end engineering (CAD) apps and required high end (at the time) hardware. But isn't it a Unix based graphics library? So then some guys at Microsoft (Eisler, Engstrom, etc...) decided lower end PC's needed graphics libraries for games and introduced DirectX. Direct3D is a subset of DirectX for 3D routines specifically. Does Microsoft still offer OpenGL? Is it open source or must be bought from SGI? If a game program calls a DirectX routine which can be done in hardware with the right graphics card, DirectX is responsible for implementing the call either through the available hardware (faster) or through its own software routine (slower)? When does DirectX know the graphics card capabilities, at run-time, or when the game is compiled? Where does WinAPI fit into all this, does it sit on top of DirectX or is totally separate. What is a good source of reading for all of this?

Thanks ahead of time.

Recommended Answers

All 4 Replies

Ok, on windows you can use GDI, DirectX and OpenGL to create games.

GDI should not be used for any games in my opinion, it is not hardware accelerated and on vista due to the software / hardware bliting it has become even slower! If you try to make a game in this you will quickly hit the wall. GDI is meant to be used for creating windows applications, not games.

DirectX is only availiable on Windows and XBox, DirectX isn't in my opinion as good as OpenGL however OpenGL has a horrible plugin system. OpenGL can do more but DirectX can do more nativly. The plugins are really inconveniant requiring differant versions for each graphics card manufacturer. OpenGl can be used on Linux, Mac, Wii, PS3 in addition to windows. So thats another advantage.

OpenGL is implemented by differant vendors, therefore some are open source and some are closed source. The capabilities of the card are of coarse only known when the program runs. GDI is completly seperate, however if you want so some reason you can hybrid DX and GDI but the hardware/software swap is slow.

>> Where does WinAPI fit into all this
That is the Windows operating system functions. OpenGL, DirectX, etc are wrappers around win32 api functions. You can do windows graphics without OpenGL or DirectX, but you can't do OpenGL without the WinAPI.

OpenGL no more 'wraps WinAPI functions' than any other program or library that happens to run on Windows. OpenGL is platform agnostic, the need for Windows API with OpenGL apps is to get access to the driver frontend, and ( perhaps ) obtain a window / device context, although OpenGL itself mandates no windowing method specifically. Maybe the software reference implementation that ships with windows wraps WinAPI calls, but that's not the version of OpenGL that most gamerz see ( install graphics card drivers and you get the driver manufacturers accelerated OpenGL driver, which should go as direct-to-the-card as possible. I have no idea what they put in their drivers, but I'll bet they make as little use of the Windows API as they can get away with ).

Same with DirectX, it is supposed to go 'under' the API, as in, provide as close-to-the-metal access to the graphics card as is feasible, card vendors provide the implementation, and if this uses WinAPI in any way, thats secondary to using the features of the hardware.

..., but you can't do OpenGL without the WinAPI.

Linux! :twisted:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.