简体   繁体   English

在Direct X 9.0c中获得LPDIRECT3DTEXTURE9的尺寸?

[英]Getting the Dimensions of an LPDIRECT3DTEXTURE9 in Direct X 9.0c?

Does anyone know if there is a function in DirectX to get the dimensions of an LPDIRECT3DTEXTURE9? 有谁知道DirectX中是否有一个函数来获取LPDIRECT3DTEXTURE9的尺寸? I just need the width and height. 我只需要宽度和高度。 If there isn't, anyone know of a quick and dirty way to accomplish this? 如果没有,那么有人知道一种快速而肮脏的方式来实现这一目标吗?

LPDIRECT3DTEXTURE 's may contain multiple images of different sizes . LPDIRECT3DTEXTURE可能包含多个不同大小的图像 You'll have to specify which one you want. 您必须指定想要的那个。 Usually, 0 is the original size, others are mipmaps that used for optimizing performance on GPU. 通常,0是原始大小,其他是用于优化GPU性能的mipmap。

D3DSURFACE_DESC surfaceDesc;
int level = 0; //The level to get the width/height of (probably 0 if unsure)
myTexture->GetLevelDesc(level, &surfaceDesc); 
size_t size = surfaceDesc.Width * surfaceDesc.Height;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM