Skip to main content
gamedev.net
🔒 Locked

Memory consuming Textures

Started by ashogay 2 replies 500+ views
Original Post
ashogay
ashogay
I'm writing a game with 3 stages. In each stage some new textures are loaded. I found out that it consumes a very large amount of memory (30-40 MB of memory!!! from pictures with file size as large as 400-500KB). I'm new to DirectX so I want to know if 1. Is there anyway to unload the textures when I'm changing to the next stage? 2. Is there any file type that is suitable for using as textures? (I used jpg) 3. If the file type is not a filetype that could be made using Adobe how can I make that file type? Thank you!!!!
mussul
mussul
Im new to dx
i guess that since IDirect3DTexture9 is an interface u can Release it to free its resources
i'd guess too that the filetypes you're using don't matter since the pixels are converted to the uncompressed vector of bytes representing the colors (bitmap), the thing I don't know is if the vector depends on the buffer format u used to create the device

sorry if i'm wrong, just coming from opengl
----------------------------Current readings:--> RedBook ..............80%-> Bjarne's C++ ...........1%-----------------------------
circlesoft
circlesoft
Quote:
Original post by ashogay
1. Is there anyway to unload the textures when I'm changing to the next stage?

Yep, just simply Release() them.

Quote:

2. Is there any file type that is suitable for using as textures? (I used jpg)

I like to use PNG, because it doesn't suffer from compression artifacts, while maintaining a fairly managable disk size. Note that the file format's size is not directly linked to the size a texture takes up in memory. For example, a 256x256 JPEG will take up the same amount of memory as a 256x256 PNG. Memory size is affected by texture format (ie D3DFMT_A8R8G8B8) - not by the file type.

DDS is also a good texture format, because it is a direct representation of a D3D surface. This means that the data doesn't have to be processed at all before creating the texture. This reduces the loading times.

Quote:

3. If the file type is not a filetype that could be made using Adobe how can I make that file type?

PNG can be exported from Photoshop, and the DXSDK comes with a DDS plugin for it.
DrunkenHyena
DrunkenHyena
Both NVIDIA and ATI have tools for converting to the various flavours of DDS.

While DXT compression is lossy it has the advantage that most video cards can read the compressed format natively so you can save a lot of video memory by using them.
Stay Casual,KenDrunken Hyena</FON

Topic Locked

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

Sign in to reply to this topic.