|
|
我今天尝试读取深度缓存,可是结果全是1,下面是我的代码片断:
........
drawScene();
readShadowDepth(viewPort[0],viewPort[1],viewPort[2],viewPort[3]);
......
其中readShadowDepth函数如下:
void readShadowDepth(int x,int y,int wid,int ht)
{
nCols=wid;
nRows=ht;
deathMap=new float[nCols*nRows];
if(!deathMap)exit(-1);
glPixelStorei(GL_PACK_ALIGNMENT,1);
glReadPixels(x,y,nCols,nRows,GL_DEPTH_COMPONENT,GL_FLOAT,deathMap);
} |
|