Skip to main content
GameDev.net gamedev.net
🔒 Locked

DX Texture Utility

Started by HippieHunter Feb 3, 2004 at 12:06 AM 8 replies 750+ views
Original Post
HippieHunter
HippieHunter
It doesnt seem to work for me, i can view all kinds of textures with it. But when i try to create one it will give me a Black sceen(in Game) no matter what the image is shown as. Now i know there is nothing wrong with my loader becouse it loads up DXT5 DDS files from the NVidia Texture Pack. Is there something im missing here?
HippieHunter
HippieHunter
OMG no one here knows what is wrong! Does anyone here even use the DirectX Texture Utility? does any one have any suggestions for a better program to use.
chollida1
chollida1
What does say photoshop or photopaint show the image as.

What format is the image??
How do you load it??

Cheers
Chris
CheersChris
HippieHunter
HippieHunter
So i just fixed my loader ploblem, all i have to do is save it from Photoshop instead of the DX Tex util. while i am happy that it works im a bit disapointed that microsoft has seemingly dissallowed the use of the DX Tex Util if your not using D3DX for image loading.
DrunkenHyena
DrunkenHyena
quote:
Original post by HippieHunter
Now i know there is nothing wrong with my loader becouse it loads up DXT5 DDS files from the NVidia Texture Pack.


Being able to load 1 set of images doesn''t prove the code is solid. If you''re saving a DDS from photoshop, then you''re probably using the NVidia plug-in. Which means that your loader handles NVidia-encoded files.

I don''t think the NVidia tools use D3DX, yet they can load those images. There are a number of DDS encoders/decoders available as source, and checking them out may help you figure out where the problem is in your loader.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON
darookie
darookie
quote:
Original post by HippieHunter
So i just fixed my loader ploblem, all i have to do is save it from Photoshop instead of the DX Tex util. while i am happy that it works im a bit disapointed that microsoft has seemingly dissallowed the use of the DX Tex Util if your not using D3DX for image loading.

This is not exactly what I would call a ''fix'', though.
Is your loader checking ny flags from the DDS header?
If so, skip them! DDS files in DXT format encoded using NVidia
tools seem to contain invalid header flags - at least the
flags they put into th header are not identical to those defined
and used by Microsoft and their tools.


HippieHunter
HippieHunter
Um i belive it is the microsoft tool that doesnt follow microsoft specs, After all im not actualy doing any decoding just loading the image directly into a compressed surface. So my conclusion is still that the NVidia plugin must be complient becouse it works directly on the card while the Microsoft version doesnt. As for you Darookie, im not checking any Flags, i dont need to i am feeding the loader a controlled image format, not to mention that i belive im following the correct procedure for loading compressed images directly into memory. As for
quote:
Is your loader checking ny flags from the DDS header?
If so, skip them! DDS files in DXT format encoded using NVidia
tools seem to contain invalid header flags - at least the
flags they put into th header are not identical to those defined
and used by Microsoft and their tools.

Didnt i just say the Nvidia plugin works and not the microsoft one? That would lead me to belive that the microsoft tool is bad! Anyway the loader works so im happy, i even got my alpha blending working thanks to Kens Tutorial. Thanks Ken!
DrunkenHyena
DrunkenHyena
You should take a sample image that wouldn''t load along with the source for your loader and send them to directx@microsoft.com. If it is a bug in the Texture Tool then they will need to know where the bug is.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON
HippieHunter
HippieHunter
Yeah about that, they probly know, thats why D3DX magicly loads files created with the Utility. But just for good measure i guess i will send it in. In case you want to see the code here it is, it is far to simple and not robust at all seeing as how it only Supports loading of DXT5 DDS files.
static void LoadTextureFromFile(char *filename, int TextureIndex )
{
D3DLOCKED_RECT pLockedRect;
DDSURFACEDESC2 *ddDesc;
FILE *in;
VOID *Header;

Header = malloc(sizeof(DWORD));
ddDesc = malloc(sizeof(DDSURFACEDESC2));

if(!(in=fopen(filename,"rb")))
{
MessageBox(GData.m_hWnd, filename, "Didnt Load",0);
return;
}
fread(Header,1,sizeof(DWORD),in);
fread(ddDesc,1,sizeof(DDSURFACEDESC2),in);
if(!GData.m_pTextureArray[TextureIndex])
GData.m_pD3DDevice->lpVtbl->CreateTexture(GData.m_pD3DDevice,ddDesc->dwWidth,ddDesc->dwHeight,0,NULL, D3DFMT_DXT5, D3DPOOL_MANAGED, &GData.m_pTextureArray[TextureIndex], NULL);
GData.m_pTextureArray[TextureIndex]->lpVtbl->LockRect(GData.m_pTextureArray[TextureIndex],0,&pLockedRect, NULL,D3DLOCK_NOSYSLOCK);

fread(pLockedRect.pBits,1, ddDesc->dwLinearSize, in);
GData.m_pTextureArray[TextureIndex]->lpVtbl->UnlockRect(GData.m_pTextureArray[TextureIndex],0);
fclose(in);
//Free Any malloc''ed Pointers

free(Header);
free(ddDesc);

}
I belive that you may have even posted a reply to a thread i started about loading images without D3DX when i first created this function.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.