Jump to content
  • Advertisement
Sign in to follow this  

Rendering Cube Map Adjustment

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!