Sign in to follow this  
ccanan

OpenGL What's the corresponding format in d3d?

Recommended Posts

I am reading some source code written in opengl, it create texture with the following format: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT GL_COMPRESSED_RGBA_S3TC_DXT3_EXT GL_COMPRESSED_RGB_S3TC_DXT1_EXT I want to write a similar one in directx,but not sure about the corresponding data format. I guess I should use the format like D3DFMT_DXT1|D3DFMT_A8R8G8B8 or D3DFMT_DXT1|D3DFMT_8R8G8B8, is that right? thx in advance!

Share this post


Link to post
Share on other sites
You can't combine formats like you suggested, so you'll have to pick just one.

I'm no OpenGL expert, but from a guess it'll be one of the DXTn formats. The difference between RGB_DXT1 and RGBA_DXT1 could be a bit misleading though - I can't remember off the top of my head, but I think D3DFORMAT_DXT1 is just RGB and it might be DXT2/3/4/5 that has a proper (pre-multiplied) alpha channel...

The SDK documentation has a section on the DXTn formats, have a read through that and see where you get. Bare in mind that it is possible there is no direct correlation between OpenGL and D3D...

hth
Jack

Share this post


Link to post
Share on other sites
There is a correlation.
DXT comes from S3's S3TC
The format is the same no matter what API you use because that's what the GPU needs.

Also, the ccanan forgot to mention GL_COMPRESSED_RGBA_S3TC_DXT5_EXT

Share this post


Link to post
Share on other sites
sorry that: I can't visit the url.
So you mean: when GL_COMPRESSED_RGBA_S3TC_DXT3_EXT is used in opengl, it's just ok to use D3DFMT_DXT3?
and both the GL_COMPRESSED_RGBA_S3TC_DXT1_EXT and GL_COMPRESSED_RGB_S3TC_DXT1_EXT both corresspond to D3DFMT_DXT1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this