Hi!
I’m trying to rendering noise in pBuffer and using it as texture.
My function is something like tha:
void OctaveManager::DrawReference(TextureO Temp, TextureO out)
{
wglReleaseTexImageARB
(mPbuffer,WGL_FRONT_LEFT_ARB)
wglMakeCurrent(mHdc, mHglrc)
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
Noise.Bind(); //here i bind the noise table texture
DrawQuad(); i draw the qaud
Temp->RenderToTexture(rand()%479, rand()%479);
//Here i cut the using glCopySubImage2D into a empty texture Temp
glClear(GL_COLOR_BUFFER_BIT);
// again i clear the pBuffer
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
Temp->Bind(); Bind ing the new cutted texture
DrawQuad(); drawign quad
wglMakeCurrent(mPrevDC, mPrevRC);
out->Bind(); bind the output texture where i want to rendering data as texture
wglBindTexImageARB(mPbuffer, WGL_FRONT_LEFT_ARB)
}
No i call it from another function passing the noise and the target texture.
It is workign fine unless, i call 2 times one after another using to target texture.
For examle:
when i call,
DrawReference(noise, &texture1);
i get the content of the pBuffer as texture1,
but when i call:
DrawReference(noise, &texture1);
DrawReference(noise, &texture2);
to get the content in two texture, i got the problem is: the texture1 is blank. but texture2 is ok.
can anyone focus a light on this problem?
Tahnk you