Texture image Format

Source: Internet
Author: User
The image file formats supported by Direct3D are:
Joint Image Expert Group (. jpg)
Windows Bitmap (. bmp)
Raster image file Storage format (. TGA)
Portable Network Image File format (. png)
Direct drawing Surface format (. DDS)
Portable pixel mapping format (. ppm)
Windows device-independent bitmap format (. dib)
High dynamic range format (. hdr)

Portable floating-point mapping Format (. PFM)


Creating and using textures

A structure called lpdirect3dtexture9 is used when loading images in Direct3D. The LPDIRECT3DTEXTURE9 structure is a texture object in the Direct3D, which is used when loading a 1D or 2D texture image. Whenever you create a lpdirect3dtexture9 texture object, the release () function of the object is called to dispose of it. When you create a texture, you can choose to manually load the image data onto the object, or use the Direct3D function to load the image data from the file onto the object. This book will start with loading the image data from the file, although the reader can load the image file from any image file format supported by Direct3D, but here the main concern is that his image file format is. bmp and. TGA in both image file formats.

To create an empty texture image, the reader can use the d3dxcreatetexture () function to manually add data to the texture. Once the texture object is successfully created, the D3dxcreatetexture () function returns a D3D_OK value (other values are returned if an error occurs). If the function returns and the texture object is null (empty), then there is a problem with the texture creation. Listing 4.1 lists the prototypes of the d3dxcreatetexture () shouting slang.

Prototype of the program manifest D3dxcreatetexture () function

HRESULT WINAPI d3dxcreatetexture (
  lpdirect3ddevice9 pdevice,   //Direct3D9 Device Object
  UINT width,//         image width
  UINT Height,//        image height
  uint miplevels,     //Picture layer, general with D3dx_default, with image quality for
  DWORD usage,        // Set how this texture is used
  d3dformat Format,   //number of bits per color component
  D3dpool Pool,       //Memory category
  where texture objects reside LPDIRECT3DTEXTURE9 * Pptexture    //points to the newly created texture object
);
    




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.