Rendering using pBuffer

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)
wglMakeCurrent(mHdc, mHglrc)

glMatrixMode( GL_MODELVIEW );
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

// again i clear the pBuffer
glMatrixMode( GL_MODELVIEW );

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

It looks like you are trying to bind 1 pbuffer to 2 textures at once, don’t think that will work…you either need a pbuffer for each texture, or use CopyTexImage to copy data from the pbuffer to the texture

Is it not possible to bind rendering content into different texture from the same pBuffer.
Yes i’m trying to create 2 texture from same pBuffer.

I tried something like this:

Goto redering context;
Render the object;
Back to Original context;
Bind the content to texture 1;

Goto rendering context;
Render the object;
Back to Original context;
Bind the content to texture 2;

is it a mistake?

In practical, in my case texture one is lost,
but texture two is ok. What is the good way to do this?

Thank you