Archive for DirectX

Managed Overlay Library

I added a managed release of the overlay library here. I had intended to add this on Friday, and I took a jab at it back then, but something came up and I couldn’t finish it.

Also, I’ve not packaged the source for the managed sample separately. So, just retrieve the latest source code from the source code tab if you want to check the sample source.

Advertisements

Comments (10)

DirectDraw Overlay Library released

I have released a beta of the overlay library at codeplex, here. The current version features the C++ library only, until I iron out some remaining issues.

Comments (8)

DirectDraw Overlays on Vista, Part II

I discovered that the overlay problem I reported earlier was caused by the Desktop Window Manager, which is responsible for compositing under Vista. The DWM expects applications to draw themselves into an off-screen surface, which it can use for compositing. The solution I found back then, which is to retrieve the DC on the primary surface, caused the locking of the primary surface, which forces the DWM to relieve control to the application and switch back to “Aero Basic” for the duration of the application.

So I came up with a more explicit solution this time:

Disabling the DWM

Leave a Comment

DirectDraw Overlays on Vista: DDERR_OUTOFCAPS

My DirectDraw Overlay Sample does not work on Windows Vista. It fails at the call to IDirectDraw7::UpdateOverlay, with the HRESULT DDERR_OUTOFCAPS. If you search online for that, you won’t find any meaningful results–only the explanation that this error occurs when the overlay capabilities are already maxed, i.e. the DDCAPS::dwMaxVisibleOverlays cap has already been surpassed.

In examining the issue, I noticed that AngelCode’s overlay sample works fine. After examining his code, the only difference in our initialization sequences is that he retrieves the device context–HDC–on the primary surface before showing the overlay. He does that because he draws manually to the overlay, and he uses GDI to figure out the format of the surface.

So, it turns out, the solution was to simply retrieve the device context on the primary surface and immediately release it before calling IDirectDraw7::UpdateOverlay.

With that problem out of the way, I’m now working on transforming my sample into a flexible, robust overlay library.

Comments (2)

Milkshape3D Model Viewer

This has been on my TODO list for a long time. I started working on this about 4 or 5 months back, I think, but kept getting distracted by other things (e.g. finals, work, etc). The announcement thread on GameDev.net can be found here.

Obligatory images:

Animated ninja model (by psionic)

Animated ninja model, by psionic

Car

Static car model, by psionic

Leave a Comment

Having DirectX Memory Leaks?

You shouldn’t. Really. Realize that there is a concept called “smart pointers“. These act just like normal pointers, except that they take into consideration the forgetfulness of humans–they make sure you don’t end up leaking something.

Now, if you didn’t know that smart pointers existed, you have a problem. A big one–you don’t know your language. It is very unfortunate that the vast majority of people choose to start with a very complex language like C++, when it only hinders their learning and development. If you’re still at an early stage, new to programming, don’t start with C++. Learn a simpler, more elegant high-level language–e.g., C#.

If you do insist on taking the C++ route, spend a couple of days reading about COM, and then check out Smart COM Pointers. Also keep in mind that there exists an excellent collecton of libraries known as boost, and that it does have smart pointers.

Good luck.

Leave a Comment