Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Creating a cubemap in D3D Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 03, 2005, 10:53 AM

I want to create a cube texture in D3D. I only find samples for dynamic cubemaps. I can't figure out how to assign an image to a face of the cube texture. Could someone give me an example or point to one, please?


April 03, 2005, 12:11 PM

It might be easier to just use the D3D texture tool, and save out the cubemap texture as a dds...


April 03, 2005, 12:35 PM

Yeah, I thought about that too.
Still, it would be nice to be able to do it manually.


April 04, 2005, 11:29 AM

If you're generating cube maps as content, try CubeMapGen from ATI (see the ATI developer page).

If you're generating cube maps at runtime, I believe you'll need to call GetCubeMapSurface and then Lock the surface pointer you get back, and write some data to it. But it's probably a lot easier to use the D3DX functions to do this stuff (for example, D3DXCreateCubeTextureFromFile).


April 04, 2005, 12:02 PM

You can create a cubemap using the D3DX function D3DXCreateCubeTexture, you can then obtain a specific surface of the cube texture by calling the GetCubeMapSurface on the IDirect3DCubeTexture9 pointer returned by the previous call (assuming it succeeded).

You can then assign to the surface in the normal way (such as locking it), or use one of the helper functions like D3DXLoadSurfaceFromFile or D3DXLoadSurfaceFromMemory etc.

If you don't want to use D3DXCreateCubeTexture, you can create one manually using the CreateCubeTexture method provided by the IDirect3DDevice9 interface.



April 06, 2005, 02:20 PM

Thanks for the advice. CubeMapGen and D3DX are a easy way to get cubemaps.

Actullay I am not familiar with the plain D3D CreateTexture functions. Maybe I should start there if I want to load a cubemap manually.
Guess I have to try google, but in case you have something you'd like to share, feel free to do so.

This thread contains 6 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.