Thursday, October 27, 2005

This is one of the reasons why we hate dealing with the rendering system:  It's hacked.  We take over the call to create that AC makes and "do things" to the object so that Decal knows when to draw.  Well it turns out that our repeating textures were directly related to this.

In the previous version of Decal, the rendering hack consisted of a proxy object, a complete reimplementation of the DX object, that told us what was happening.  Under this model, AC had a reference to our proxy, and we had the real object.  In the new system, we decided to go with another method, vtable patching, which only alters the particular functions we want.

Well, as things would have it, Checksum created the initial hooking setup for Decal3, not Haz or myself, so this little detail wasn't exactly fresh in our minds.  So here we are, testing various ways of drawing to the screen, expecting the DX object to behave normally, but we keep getting this weird repeating effect.  We found a few methods to, ah... minimize the visible effect, but this backfired when multiple huds were generated.

Well it just so happened that Check popped up again while we were exploring the issue, took a glance at our code, and "reminded" us about the hook.  We nearly died when we realized what was actually happening.

To keep Decal drawing on the screen on top of AC's 3D, we hook a DX function called EndScene.  When AC calls this function, we send a signal to Decal to do all of it's rendering work.  Well, in our new HUD implementation, we use a technique that renders on an off-screen texture instead of the main window.  As part of that operation however, we have to call EndScene.  It turns out that our repeating texture was actually a recursion issue that somehow fixed itself before causing a crash.  So we reworked the code a bit to call the real EndScene and no more issue.

Just goes to show you how being too close to a particular project can bite you when the bugs creep up.

posted on Thursday, October 27, 2005 4:09:23 PM (Central Daylight Time, UTC-05:00)  #    Comments [1] Trackback
Related posts:
Ugly, Isn't It?
Resurrecting Nerfus Buffus
Adapter Messages...
Coming soon to Decal
Delayed
Updates and fun results