Game Development Community

Another texture lock bug

by Tom Spilman · in Torque Game Engine Advanced · 12/22/2006 (5:21 pm) · 6 replies

This time the bug is in GFXD3DTextureObject::lock(). This code...

if(inRect)
      {
         r.top  = inRect->point.x;
         r.left = inRect->point.y;
         r.bottom = inRect->point.x + inRect->extent.x;
         r.right  = inRect->point.y + inRect->extent.y;
      }

... should be this...

if(inRect)
   {
      r.top  = inRect->point.y;
      r.left = inRect->point.x;
      r.bottom = inRect->point.y + inRect->extent.y;
      r.right  = inRect->point.x + inRect->extent.x;
   }

Notice how the the x and y coords were all backwards. ;)

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.


#1
12/22/2006 (5:30 pm)
I hate you, DX coordinate conventions. :)

Issue #2485.
#2
12/24/2006 (1:15 am)
With this bug fix, will it affect anything specifically ingame, such as Atlas? I am seeing what looks to be flipped texture rectangles on our current Terrains and the only change I know of that would be related is this one..


Edit: It actually is causing crashes in Atlas ClipMap, I am guessing because the texture X/Y are in theory different with the fix. So I assume we'll need to redo our terrains to fix the crashing
#3
12/24/2006 (2:36 am)
Cool!
#4
12/24/2006 (9:45 am)
@Jeremiah - I didn't test it with Atlas, but it is possible that it is effecting it. Please post the Atlas fix for this change if you can.
#5
12/24/2006 (12:03 pm)
I will give it a run thru and see if its a fixable in Atlas itself, or if the terrains will have to be recreated... Or Version bump new terrains and hack in backwards compatibility (which could be messy)
#6
12/24/2006 (1:03 pm)
Well, I did a quickie new Atlas terrain and its still coming out messed up. I havent dug into the generation of the Clip Map or how its being handled.

img172.imageshack.us/img172/9272/core00000010ev0.jpg

The screenshot there shows what it looks like (which seems to be mis-sized).. and right after that part, itll crash the Engine

It would seem that the ClipMap isn't generated to the proper size, although from the part of code I saw, the X and Y are used properly, so must be somewhere else that I haven't looked.


Or Ben could find it and tell us! :)