Jump to content
  • Advertisement
Sign in to follow this  

glCompressedTexImage2D to Direct3d 11

Recommended Posts

I am a porting some code from opengl to Direct3d.  

glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, Width, Height, 0, bufferSize, (const GLvoid*)buffer);

I port this to Direct3D 11 with:

HRESULT hr = CreateDDSTextureFromMemory(device, buffer, bufferSize, nullptr, &srv);

but it fails early saying the data is not a DDS texture when it checks the header.  I assumed the above compressed formats would port to DDS.  Is there a workaround or way to convert?



Share this post

Link to post
Share on other sites
12 hours ago, Quat said:


is a helper / utility function (not part of D3D itself) that loads images that have been saved in the DDS image format. Are your images in that format? If not, then you don't want to be using that function.

You can, however, look at the source code to CreateDDSTextureFromMemory to see which actual D3D functions it's using to create a texture resource, copy compressed image data into that resource, and then make an SRV for the resource so it can be bound to shaders.

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  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!