Archived

This topic is now archived and is closed to further replies.

Spacecat

How to change a surface's D3DFORMAT?

Recommended Posts

Hello all, I''m sure it''s been asked and answered before but unfortunately the search function is down. Ick. I am using the GetFrontBuffer call to take a snapshot, and I need to save it into a surface to work with it. -On one hand GetFrontBuffer -always- returns a D3DFMT_A8R8G8B8. -On the other hand, I know from experimenting with my VooDoo3 PCI that I must work with the backbuffer''s format for creating render-ok surfaces and textures on old cards. No trusting D3DXCreateTexture to guess the right format, it crashes! This means that I must find a way to take my D3DFMT_A8R8G8B8 surface and -convert- it to another format. Potentially even one with a different bitdepth. And my question is: How does one convert a surface format to another format? The only way I can think of involves saving a bmp and reloading it. =^.^= Leaders and teachers should remember: It is best to offer others what they Need not what they Want.

Share this post


Link to post
Share on other sites
Nevermind! I finally found it!

It turns out that the API D3DXLoadSurfaceFromSurface is fully capable of transforming a surface into one of a different size, or even a different format As long as the Filter is specified!

It just wouldn''t work with a NULL parameter for the filter. I tried it with Linear, and voila!

Share this post


Link to post
Share on other sites