Sign in to follow this  
programwizard

Does DirectX just wrap the Win32 API?

Recommended Posts

Are the DirectX functions actually calling Win32 functions in the background? Or does it bypass the Windows API and work at a lower hardware level? Been bugging me for the longest time, and I couldn't find the answer anywhere.

Share this post


Link to post
Share on other sites
DX functions aren't wrappers, with the possible exception of DirectInput (supposedly nowadays it just uses window messages internally). DX operates on a level really close to the hardware so stuff is pretty dang fast. If it simply called win32 functions, there wouldn't be much of a point learning DX would there? [smile]

Share this post


Link to post
Share on other sites
Nope, as load_bitmap_file said.
Take a look at this definition of what DirectX is.

"DirectX is a set of low-level APIs for creating games and other high-performance multimedia applications. It includes support for high-performance 2D and 3D graphics, sound, and input.

The Microsoft DirectX software development kit is your backstage pass to multimedia applications that sizzle. DirectX is a set of low-level APIs for creating games and other high-performance multimedia applications. It includes support for high-performance 2-D and 3-D graphics, sound, and input."


Take a look at this definition of what Direct3D is.
"Direct3D is an API, owned and developed by Microsoft for the creation of 3D games. It is used for manipulating and displaying three-dimensional objects. Direct3D provides programmers with a way to develop 3-D programs that can utilize whatever graphics acceleration device is installed in the machine. Virtually all 3-D accelerator cards for PCs support Direct3D."

I hope this helps somewhat,
PS: reading this again kinda made me think (why did I paste this). Oh well, I hope it gives you some information about DirectX not being wrappers but actual APIs that tie to the hardware.

PS: after some discussions, I have to say that the Win32API definitely does come into play. So I guess DirectX wraps win32 in someways. :D

[Edited by - Armadon on April 5, 2006 12:16:26 AM]

Share this post


Link to post
Share on other sites
DirectInput keyboard&mouse wraps Win32 window messages, and I believe that other parts of it wrap other APIs too in certain situations (e.g. the Raw Input API). DirectPlay wraps WinSock (amongst other things). I'm pretty sure that all the other parts are plugged in at the driver level.

Share this post


Link to post
Share on other sites
In fact, some Win32 APIs wrap DirectX. I believe that GDI+ is optimized to use DirectDraw internally. And of course, Vista makes heavy use of D3D9L.

Share this post


Link to post
Share on other sites
Actually, some functions do use WIN32 functions under the covers, like the D3DX functions that take pointers to strings (LPCSTRs) for file names. The HAL is only part of it all. DX does a lot more than just send data to the GPU.

Share this post


Link to post
Share on other sites
Quote:
Original post by DXnut
Actually, some functions do use WIN32 functions under the covers, like the D3DX functions that take pointers to strings (LPCSTRs) for file names. The HAL is only part of it all. DX does a lot more than just send data to the GPU.

Yea, I suppose that D3DX does use it somewhat, for all of the file access, ect. However, all of the core low-level APIs (ie D3D) don't call into general Win32 stuff all that much.

/wishes my SharedSource smart card reader would fix itself :-/

EDIT: One thing D3D does do with the Win32 API is hook into your window's messages. This way, it knows when a device reset is necessary, ect. This is why you have to specify the top-level HWND when you create a device.

[Edited by - circlesoft on April 5, 2006 12:11:06 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this