Sign in to follow this  
ImpulseOverload

SetTexture from single face of CubeTexture? (DX9)

Recommended Posts

I've been trying to create a simple debugging function for displaying a cube cross of a cube map texture. I want to be able to set each face of the cube texture so I can draw 6 quads with each face individually. I know I can get the surface of each face on the cube texture with GetCubeMapSurface, and I was able to create a scratch texture created from this surface and then set that texture. It worked and I got all faces to draw... but I'm really trying to avoid using a scratch texture and having to copy surfaces because this function is not intended to keep around these scratch textures thus I'm suffering from huge performance problems doing this each frame. I tried to use the GetContainer(IID_IDirect3DCubeTexture9,&pContainer) on the surface but no matter which face the surface is when I cast pTexture = (LPDIRECT3DBASETEXTURE9)pContainer; and set the texture, The rendered face is always the same. Option 3 would be to write a custom shader that looks up the faces uv from a set cube map and texCube, I'd like to avoid this too because I don't want to create a special case shader here. Is there a proper way to set a cube texture face as the current texture?? It seems to me that this should be really straight forward and possible to do. I can get 1 face to draw, why not the others? Any help would be great!!

Share this post


Link to post
Share on other sites
Quote:
Original post by ImpulseOverload
Option 3 would be to write a custom shader that looks up the faces uv from a set cube map and texCube, I'd like to avoid this too because I don't want to create a special case shader here.


That sounds pretty straightforward to me. [smile]

You can't get individual textures from a cube texture because a cube texture doesn't contain individual textures. It contains a collection of surfaces. This is why the container you get is always the same, there's only one container for those 6 surfaces.

Share this post


Link to post
Share on other sites
Yeah that's what I thought, I figured I was hitting a dead end with that. Thanks for the confirmation. I implemented it thought a shader, it works great and the performance is really high. The real tricky part was must making sure the faces were flipped and rotated correctly.

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