Jump to content
  • Advertisement
Sign in to follow this  

shadow mapping

This topic is 1443 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

in this snippet code , it is located in many articles


// Create the shadow map
if( FAILED( g_pd3dDevice->CreateTexture( SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, 1,
                                         D3DUSAGE_RENDERTARGET, D3DFMT_R32F,
                                         D3DPOOL_DEFAULT, &g_pShadowMap,
                                         NULL ) ) )
MessageBox( g_hWnd, "Unable to create shadow map!",
             "Error", MB_OK | MB_ICONERROR );
return E_FAIL;

// Grab the texture's surface
g_pShadowMap->GetSurfaceLevel( 0, &g_pShadowSurf );


my question is : Is this code is located into the render loop or it is located outside of it? (i mean it must be located or not into the render loop)

Edited by abdellah

Share this post

Link to post
Share on other sites

You never want to be creating resources inside of your render loop. Creating resources is slow, and best done during initialization or loading.

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!