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

Texture Question

Started by The Frugal Gourmet Mar 27, 2004 at 5:47 PM 2 replies 650+ views
Original Post
The Frugal Gourmet
The Frugal Gourmet
When I load a texture using the DirectX API, how is stored on my graphics card? Is it stored in the same format that it is stored on the disk, or is it converted to my screen surface format? Or is it only converted to my screen surface format when I use SetTexture? In other words, is the amount of memory each texture takes up dependent on my screen format or on the texture format originally?
Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.
circlesoft
circlesoft
IIRC, it''s the format of the original texture format (the file on disk). However, if you specify a D3DFORMAT other than D3DFMT_UNKNOWN (look at the D3DXCreateTextureFromFileEx() function) for the requested pixel format, it''s going to depend on that. Specifying D3DMT_UNKNOWN pulls the format from the file.


Dustin Franklin
Mircrosoft DirectX MVP
hplus0603
hplus0603
Actually, the driver has some latitude to convert the texture on upload (after you unlock the surface). For example, for higher benchmark scores, drivers have been known to always convert to 16-bit textures, even if you create a 32-bit texture and lock/upload 32-bit data. This behavior is usually controllable through control panel settings.
enum Bool { True, False, FileNotFound };
The Frugal Gourmet
The Frugal Gourmet
Cool. So I can save memory space by utilizing less colors or a smaller alpha channel, even if my display is X8R8G8B8? Good to know. Thanks.

Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.

Topic Locked

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

Sign in to reply to this topic.