コード例 #1
0
ファイル: ShadowMap.cpp プロジェクト: zulman/qutemol
void ShadowMap::computeAsTexture(vcg::Point3f L, bool makeboth, MyCanvas &canvas){
  
  if (lastL!=L) {
  
    canvas.SetAsOutput();
      

    setMatrices(L, canvas.GetSoftRes(),canvas.GetHardRes(), true);
    glClearDepth(1);  
    glClear( GL_DEPTH_BUFFER_BIT );
    glDisable(GL_SCISSOR_TEST);
    glDepthFunc(GL_LESS);
    
    m.DrawShadowmap(false);
    restoreMatrices();

    
    if (hardSettings.doubleSM && makeboth) {
      setMatrices(L, canvas.GetSoftRes(), canvas.GetHardRes(), false);
      glClearDepth(-10000);      
      glClear( GL_DEPTH_BUFFER_BIT);
      glDepthFunc(GL_GREATER);

      glDisable(GL_SCISSOR_TEST);

      m.DrawShadowmap(false);

      restoreMatrices();
    }

    glClearDepth(1);  
    glDepthFunc(GL_LESS);

    mainCanvas.SetAsOutput();
  
    lastL=L;
  }
  
  glActiveTextureARB(GL_TEXTURE1_ARB); 
  
  canvas.SetAsTexture();

}