I am trying to shift my depth buffer down.
The following code works when my readpixels/drawpixels funtions use type GL_FLOAT with float buffer, but the glReadPixels is to slow.

Using the type GL_UNSIGNED_SHORT the readpixels function is fast but something does not work. Does anybody know if this code should work with GL_UNSIGNED_SHORT.

glRasterPos3f( 0.0f, 0.0f, 1.f );
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

glReadPixels(
fXOffset,
fYOffset,
m_PBuffer.nWidth-fXOffset,
m_PBuffer.nHeight-fYOffset,
GL_DEPTH_COMPONENT ,
GL_UNSIGNED_SHORT,
g_pDepthMap );

glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);


TRACE( "!PBUF: depth read\n", m_nXOffset, m_nYOffset );

glReadPixels(
fXOffset,
fYOffset,
m_PBuffer.nWidth,
m_PBuffer.nHeight,
GL_RGBA,
GL_UNSIGNED_BYTE,
g_pByteMap );


glClearDepth( 0.0f );
glClear( GL_DEPTH_BUFFER_BIT );
glClear( GL_COLOR_BUFFER_BIT );

glDrawPixels(
m_PBuffer.nWidth,
m_PBuffer.nHeight,
GL_RGBA,
GL_UNSIGNED_BYTE,
g_pByteMap );

TRACE( "!PBUF: finished copy\n", m_nXOffset, m_nYOffset );
glRasterPos3f( 0.0f, 0.0f, 0.f );

glEnable( GL_DEPTH_TEST );
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthFunc( GL_ALWAYS );
glDrawPixels(
m_PBuffer.nWidth-fXOffset,
m_PBuffer.nHeight-fYOffset,
GL_DEPTH_COMPONENT ,
GL_UNSIGNED_SHORT,
g_pDepthMap );

glDepthFunc( GL_GEQUAL );

glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

TRACE( "!PBUF: finished depth draw\n", m_nXOffset, m_nYOffset );


glEnable( GL_DEPTH_TEST );


I am using a nvidia GFFX 5700 ultra.

The above code is drawing in a PBuffer.

Thanks,