Sign in to follow this  
DrGUI

Rendering Cube Map Adjustment

Recommended Posts

DrGUI    402
I was trying to find out how to render a cube map, so I was looking at the HDRFormats sample which renders a cube map. I don't understand why the sample uses the back buffer dimensions to adjust the transformed geometry. // Map texels to pixels float fHighW = -1.0f - (1.0f/(float)pBackBufferSurfaceDesc->Width); float fHighH = -1.0f - (1.0f/(float)pBackBufferSurfaceDesc->Height); float fLowW = 1.0f + (1.0f/(float)pBackBufferSurfaceDesc->Width); float fLowH = 1.0f + (1.0f/(float)pBackBufferSurfaceDesc->Height); pVertex[0].pos = D3DXVECTOR4(fLowW, fLowH, 1.0f, 1.0f); pVertex[1].pos = D3DXVECTOR4(fLowW, fHighH, 1.0f, 1.0f); pVertex[2].pos = D3DXVECTOR4(fHighW, fLowH, 1.0f, 1.0f); pVertex[3].pos = D3DXVECTOR4(fHighW, fHighH, 1.0f, 1.0f); In the sample's vertex shader, the vertices' position is transformed using the inverse wvp matrix and used in the pixel shader to look up the cube map color I don't understand what the back buffer dimensions has to do with it - can someone explain. If you need to look at all the code, it the skybox.cpp under the HDRFormats sample. Thanks for your help [Edited by - DrGUI on March 29, 2005 5:43:29 AM]

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