GLX Pbuffer and glCopyTexImage2D troubles.

Hey, I’ve been trying to create a pbuffer for rendering then copy it to a texture an render it in my main RC. I created a small pbuffer library that seems to work. However, rendering it fails. I either get a black nothing if I used glTexImage2D before glCopyTexImage2D/glCopyTexSubImage2D or a white if I don’t. OpenGL doesn’t flag any errors and GLX doesn’t return any error codes. I’ve been scratching my head over this for a couple of days and would appreciate any help.

You can get the test sourcecode I’ve written from

I never made any pbuffering yet. Try the linux specific forum: there are no more much people here, but they might find out your post more easily than under this forum (that have many people come here, so posts disappear quiete quickly).

I downloaded your tarball, I’ll see what I can do… But I’m not the best one for that.

Ok. A bit more info.

Still not working, but inserting glRasterpos2i(0, 0) before glCopyTexImage2D will make the texture black, always.

Texture sharing between contexts work (I made a small dummy texture in the pbuffer context and rendered it in the main context.)

It may be a simple error, but my head hurts after staring at it for hours. :frowning:

Aaargh, thing’s getting stranger.

If I query the width and height of the pbuffer after creating it, i get 0x0, and my square turns white again. I think it being white means that something went wrong somwhere. I used:

  glXQueryDrawable(display, buffer, GLX_WIDTH, &width);
  glXQueryDrawable(display, buffer, GLX_HEIGHT, &height);

tor retrieve the attributes.

Further, glxReadPixels doesn’t seem to work properly either. I read the pixels, then use glTexImage2D. The result however isn’t entirely black. There are three colored dots in the lower left corner. I think I’m getting some scrap bits from somewhere.

It’s insane …

I’ve took a look at your program, I also needed to read the pbuffer spec (can be found on this website).
For testing at least, I recommand you to check almost all what you’re doing (like your sizes, pbuffer state…).

Try first to do a pbuffer with the same context than your drawing context. I don’t remember well how, but it’s also easy to not have the textures shared between two contexts. And I don’t really remember well how to correct that. It might be more difficult with staying with glut. So try a little X11/glx demo and modify some values in order the drawable can hangs both a window and a pbuffer.

I cannot say more.

Hope this helps (a bit).

  • Try also to post or continue thsi thread on the linux forum.
    Most people here don’t give any attention to your thread just because they’re expecting for advanced opengl issues.

  • Also try to have a look at this post:
    a seamy topic

Thanks for the suggestions, but I’m still unable to resolve the problem. I’ve seen the thread you linked too and in it you link, indirectly, to some code exactly like mine (glut+glx pbuffer+glcopyteximage2d) that works! Sadly I’m not able to spot the difference.

I’ve taken your advice now and started a sibling thread in the Linux forum.