Load a CubeMap from a .dds file

Hi, has anyone tried to load a dds file with a cubemap and set it as a texture to a cube object?
I create a cubemap with Ati CubeMapGen tool, but I get always the same error when I try to load the dds file and I set it to the model.

  • What I do:
    texture = Texture()
    ts = StringStream(filename)
    texture.readDds(ts)
    model.setTexture(texture)

  • The error is (It crashes when I call readDds() method):
    Assertion failed: !_in->eof() && !_in->fail() at line 105 of c:\buildslave\release_sdk_win32\build\panda3d\dtool\src\prc\streamReader.cxx
    :gobj(error): is not a DDS file.

I attach a dds file example.
Thanks in advance!

Please do attach the file so that I can try it for myself. Thanks!

Sorry I couldn’t upload it without compress it before. Extension not allowed…
Map_1.zip (6.8 KB)

When I simply try loading it with loader.loadTexture it works fine. The problem is that you’re using StringStream which is an memory stream (not a file stream), and you’re loading the filename string into it. So Panda errors because the filename string is, of course, not a .dds file.

Keep in mind that if you want to avoid the texture loader, you can just call texture.read(“something.dds”), and Panda will do the right thing automatically.

Thanks for your answer!
I´ve tried to use loader.loadTexture but the cubemap is not shown properly. Is it maybe something wrong with the cube egg file?
What I mean is that when I load a regular texture it is shown properly, but with a cubemap using the same texture for all six faces, the texture is not shown properly.