Hi,have anyone encounter the this problem?
I want to use Render-To-Texuture in my problem, but it is a multi-pass algorithm.
That’t is to say, the result of Render-To-Texture would be used in the next pass as an input texture.
In the following program, I introduce an intermediate texture as the texture of Render-To-Texture,
then swap it with the input texture. BUT NO way to realize my idea, I am nearly crazy about this.
Initially the data from texture resultTextureID is zero.
for(i=0; i<nPass; i++)
{
glBindTexture(_iTextureTarget, intermedTextureID);
wglReleaseTexImageARB(_hPBuffer, WGL_FRONT_LEFT_ARB);
wglMakeCurrent( _hDC, _hGLContext);///PBuffer context
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(_iTextureTarget, resultTextureID);
///Here I check it, the data from texture resultTextureID is zero,
///even in the next pass
DrawSomeThingWidthTexture_resultTextureID;
glBindTexture(_iTextureTarget, intermedTextureID);
wglMakeCurrent( _hPreviousDC, _hPreviousContext);
wglBindTexImageARB(_hPBuffer, WGL_FRONT_LEFT_ARB);
///Swap the Texture ID
tempID = intermedTextureID;
intermedTextureID = resultTextureID;
resultSetTextureID = tempID;
////Here I find the the data from texture resultTextureID is the rendering result
////But why in the next pass, it returns to zero?
////And I think in the begining of each pass, just the data from intermedTextureID should be zero
////WHY?
}
Am I made myself clear? And I find no reference in the specificatioin about this. So hope gurus come here. Thanks for any suggestion.
[This message has been edited by foollove (edited 02-04-2004).]