Hi,
I’m trying to render into a pbuffer subbuffer (e.g. WGL_FRONT_LEFT_ARB) and at the same time I want to use subbuffers of the pbuffer (WGL_BACK_LEFT_ARB, WGL_AUX0_ARB) as texture uniforms for my fragment program. I don’t even know if that’s possible, but I think I read about that somewhere.
This is roughly how I thought it could work:
(using a GeForce 6800 GT)
_oFPBuffer.activate();
...
glActiveTexture(GL_TEXTURE2);
glEnable(GL_TEXTURE_2D);
glGenTextures(1, _iTexRead);
glBindTexture(GL_TEXTURE_2D, _iTexRead);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
...
glDrawBuffer(WGL_FRONT_LEFT_ARB);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, _iTexRead);
if( !wglBindTexImageARB(&_oFPBuffer, WGL_BACK_LEFT_ARB) )
{ ... error ... }
glUniform1iARB(_iTexUnitDiagN1, 2);
...
glBegin(GL_QUADS);
{ ... }
glEnd();
glActiveTexture(GL_TEXTURE2);
wglReleaseTexImageARB(&_oFPBuffer, WGL_BACK_LEFT_ARB);
...
For the next pass I want to render into the buffer that I used for reading in this pass. Accordingly I want to read the buffer that has the results from the previous pass.
wglBindTexImageARB() always results (GetLastError) in error code 3221684230 which is neither ERROR_INVALID_OPERATION, ERROR_INVALID_DATA, nor ERROR_INVALID_WINDOW_HANDLE.
I use the following attributes for my pbuffer:
int attribList[] =
{
WGL_SUPPORT_OPENGL_ARB, true,
WGL_RED_BITS_ARB, 32,
WGL_GREEN_BITS_ARB, 32,
WGL_BLUE_BITS_ARB, 32,
WGL_ALPHA_BITS_ARB, 32,
WGL_STENCIL_BITS_ARB, 8,
WGL_DEPTH_BITS_ARB, 24,
WGL_FLOAT_COMPONENTS_NV, true,
WGL_BIND_TO_TEXTURE_RGBA_ARB, true,
WGL_DRAW_TO_PBUFFER_ARB, true,
WGL_DOUBLE_BUFFER_ARB, true,
WGL_AUX_BUFFERS_ARB, true,
0,
};
and the following pbuffer related extensions in my program:
"GL_NV_float_buffer " \
"WGL_ARB_pixel_format " \
"WGL_ARB_pbuffer " \
"WGL_ARB_render_texture " \
"WGL_ARB_extension_string "
Any idea how I can get this working?
Thanks a lot!