Archived

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

DirectX 7 probs: DXT surface

This topic is 5583 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, this is slightly embarrassing but I can''t seem to create DXT surfaces in DirectDraw (7). This is the code I''m using, it''s in C#, but anyone familiar with the C syntax should have no problems.
// set up the source and destination surfaces
DDSURFACEDESC2 ddsdDest = new DDSURFACEDESC2();
ddsdDest.lFlags = CONST_DDSURFACEDESCFLAGS.DDSD_HEIGHT | CONST_DDSURFACEDESCFLAGS.DDSD_WIDTH | CONST_DDSURFACEDESCFLAGS.DDSD_PIXELFORMAT | CONST_DDSURFACEDESCFLAGS.DDSD_CAPS;
ddsdDest.ddsCaps.lCaps = CONST_DDSURFACECAPSFLAGS.DDSCAPS_OFFSCREENPLAIN | CONST_DDSURFACECAPSFLAGS.DDSCAPS_SYSTEMMEMORY;
ddsdDest.lHeight = iHeight;
ddsdDest.lWidth = iWidth;

// set up pixel format
ddsdDest.ddpfPixelFormat.lFlags = CONST_DDPIXELFORMATFLAGS.DDPF_FOURCC | CONST_DDPIXELFORMATFLAGS.DDPF_COMPRESSED;
ddsdDest.ddpfPixelFormat.lFourCC = (Int32)FCCFormat;
			

// create the actual surface
DirectDrawSurface7 ddsDest = dd.CreateSurface(ref ddsdDest);
  
I''ve tried setting the caps to TEXTURE instead of offscreenplain - to no avail - and FCCFormat is assigned 0x31545844 earlier on in the code. (DXT1) The error I''m getting is "invalid pixel format" (0x88760091). Creating standard RGB(A) surfaces is working just fine by the way, so it''s none of that cooperative level stuff. Cheers - JQ Full Speed Games. Coming soon.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Open up the "Compress" sample in the DirectX7 SDK. In there you should find the caps for loading a .DDS file.

It should also have code for loading the file onto a surface that is compatable with the 3DDevice if the DDS format isn''t natively supported on the card.

Share this post


Link to post
Share on other sites
Dammit, I downloaded the SDK, and the sample can''t load it either, the gfx card seems to be REALLY crappy here at work. (oh well, so much for using part of my lunch hour for game development - I guess it serves me right )

- JQ
Full Speed Games. Coming soon.

Share this post


Link to post
Share on other sites
Check this site out http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/ddraw7/directdraw7/ddover_2jef.asp

You should also use the enum funtion to find the proper pixel format, and if it is supported

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Check to make sure that your graphic card supports that mode. You can check the available modes with the DirectX Caps Viewer.

Hope this helps

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Check to make sure that your graphic card supports that mode. You can check the available modes with the DirectX Caps Viewer.

Hope this helps

Share this post


Link to post
Share on other sites