TGEA 1.7.1 - DDS images that are non-pow2 render incorrectly.
by Stefan Lundmark · in Torque Game Engine Advanced · 06/23/2008 (12:21 am) · 8 replies
Edit: Just noticed I mistyped the subject-line. "Non-pow2" should be "Non-Square". Ie, 512x512 works but 800x600 does not.
If you save scriptsAndAssets/client/ui/unified_background.jpg as a DDS file, you'll notice that the bottom part of the image gets screwed when you load it ingame. This is also the case in 1.0.3, so it is not recently introduced.
If you save scriptsAndAssets/client/ui/unified_background.jpg as a DDS file, you'll notice that the bottom part of the image gets screwed when you load it ingame. This is also the case in 1.0.3, so it is not recently introduced.
#2
06/23/2008 (12:20 pm)
800x600 isn't pow2?
#3
06/23/2008 (12:29 pm)
No it's not. Pow2 numbers can be expressed in the form 2^x where x is an integer. e.g. 2^1 = 2, 2^2 = 4, 2^3 = 8, etc.
#4
512x256 - Bad.
800x800 - Good.
512x512 - Good.
06/23/2008 (12:45 pm)
Got you. And here's what I'm seeing:512x256 - Bad.
800x800 - Good.
512x512 - Good.
#5

Notice how the image is not cropped, it is just shrinked in its height. I have been trying to find where it is doing this for a while now but all I am seeing is the same stuff as a identical PNG.
06/23/2008 (2:36 pm)
This is how it looks like:
Notice how the image is not cropped, it is just shrinked in its height. I have been trying to find where it is doing this for a while now but all I am seeing is the same stuff as a identical PNG.
#6
GFXTextureManager.cpp @ 476
Should be:
GFXTextureManager.cpp @ 497
Should be:
07/15/2009 (4:18 pm)
Sigh. I'm sure it was reported to be fixed before but since it wasn't, here goes:GFXTextureManager.cpp @ 476
_validateTexParams( dds->getHeight(), dds->getWidth(), profile, numMips, fmt );
Should be:
_validateTexParams( dds->getWidth(), dds->getHeight(), profile, numMips, fmt );
GFXTextureManager.cpp @ 497
ret->mBitmapSize.set( dds->mHeight, dds->mWidth, 0 );
Should be:
ret->mBitmapSize.set( dds->mWidth, dds->mHeight, 0 );
#7
In the process, I found two more instances where height and width got swapped.
In DDSFile, the getSurfaceSize method that takes only a miplevel has the problem (within DDSFile, height always comes first).
In the GFXTextureManager::_createTexture method you have changed above, the _createTexture calls do this as well (in TGEA, there's only one).
//Edit: Hmm, found that the swapping is necessary to get the correct pitch on texture surfaces with non-square DDSs. Too tired now to find out why.
07/16/2009 (1:34 am)
Thank you, Stefan. Checked into repo and hopefully gone for good now.In the process, I found two more instances where height and width got swapped.
In DDSFile, the getSurfaceSize method that takes only a miplevel has the problem (within DDSFile, height always comes first).
In the GFXTextureManager::_createTexture method you have changed above, the _createTexture calls do this as well (in TGEA, there's only one).
//Edit: Hmm, found that the swapping is necessary to get the correct pitch on texture surfaces with non-square DDSs. Too tired now to find out why.
#8
07/16/2009 (4:31 am)
Thanks. So the getSurface method is correct? Cool!
Associate Alex Scarborough