PBuffer & Render to Texture (read & write)

habicht
Unregistered
 
Post: #1
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)

Code:
_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:

Code:
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:

Code:
"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!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
apparently the aqua theme doesn't help at all, after all Smile
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #3
OneSadCookie Wrote:apparently the aqua theme doesn't help at all, after all Smile

You mean to scare away windows programmers? I was wondering about the aqua theme...
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #4
Maybe some day we'll all be using EXT_framebuffer_object, but for now the specifics of pixel formats and window/pbuffer drawables are highly OS-specific. So this question is better asked on the Windows OpenGL forum. iDevGames is Macintosh-centric.
Quote this message in a reply
habicht
Unregistered
 
Post: #5
Ooops! Maybe I was already too tired yesterday... :-)
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Render to Texture behaves weirdly ardowz 2 870 Feb 17, 2014 04:50 PM
Last Post: ardowz
  Render video (e.g. QuickTime) to buffer or texture? Ingemar 14 12,393 Jun 8, 2011 04:09 PM
Last Post: mdejong1024
  pbuffer blending problem on macmin g4 madjerry 4 3,589 Nov 27, 2009 03:14 AM
Last Post: madjerry
  Render to Texture? IBethune 5 5,851 May 2, 2007 04:25 AM
Last Post: IBethune
  Pbuffer problems on Intel NVIDIA GeForce 7300 GT NYGhost 5 4,059 Oct 26, 2006 09:39 AM
Last Post: NYGhost