XNA Creators Club Online
Page 1 of 1 (9 items)
Sort Posts: Previous Next

Creating a cube map texture from 6 bitmap resource

Last post 23/11/2009 7:43 AM by Toine db. 8 replies.
  • 26/10/2009 11:37 AM

    Creating a cube map texture from 6 bitmap resource

    Hi,
    I want to make an app (st like a screen saver) which must create a 3d environment from 6 images stored in its resouces(cube mapping) but as far as I know it is only possible to create a cube map texture from a .dds file created by dxtex tool.
    so is there a way to create a cube map from anything other than that?
  • 27/10/2009 2:51 AM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    What's wrong with the dxtex tool? (Ok, other than a mediocre UI)

    You could create the cube map at runtime by drawing the 6 faces into a new cube map
    http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.rendertargetcube.aspx

    ATI AMD has CubeMapGen, which a a bunch more options and lets you save a DDS file.
    http://developer.amd.com/gpu/cubemapgen/pages/default.aspx

    You could probably also make your own content processor to stitch them together.
  • 27/10/2009 5:36 AM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    You can make your own tool if you like. The DDS format is well documented and can be found here. That should include everything you would ever need to know about DDS.
  • 27/10/2009 10:53 AM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    There is nothing wrong with dxtex but I need my executables to be able to run with no other dependencies therefore I need to embed textures as resources, also since I need to be able to change embeded textures of exe's later, they must be regular bitmaps.
    (think of a screen saver generator which imports bitmaps and exports portable screen saver exes)

     also I'm not using managed directx.
  • 27/10/2009 6:54 PM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    You can create a cube map with IDirect3DDevice9::CreateCubeTexture, then once you created the cube map, you lock the face with the following function IDirect3DCubeTexture9::LockRect and upload the texture into the D3DLOCKED_RECT struct this gives back.

    In DX 10 you use ID3D10Device::CreateTexture3D with a misc flag saying its a textureCube.
  • 28/10/2009 9:24 AM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    Thanks, Yes that should do it but I don't know how to work with LockRect(), any sample would be greatly appreciated.
  • 29/10/2009 4:33 PM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    The D3DLOCKED_RECT is a structure that contains a pointer to the bitmap data and a pitch value. The pitch value tells you how many bytes there are in one row, the format tells you how long one pixel is so from there on you can calculate how many pixels are in one row and how much is padding. Padding data has no value and you dont have to give it a value.
  • 12/11/2009 7:36 AM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    Noekk, nice concept. I was looking to do a same thing.

    Is it possible you can show your source? (im a noob at XNA so i don't know where to start)
    Consultant at Logica Netherlands
  • 23/11/2009 7:43 AM In reply to

    Re: Creating a cube map texture from 6 bitmap resource

    Mean while I tried to make the cube in a different way then yours, and this is the anwsered topic about that.
    Maybe its handy for you 2

    http://forums.xna.com/forums/t/42802.aspx
    Consultant at Logica Netherlands
Page 1 of 1 (9 items) Previous Next