Hello Johannes, On 2015-11-19 09:50, Johannes Brunen wrote: > after Gerrit was so kind to provide a FBOBackground on my request, I > have taken the time to write a FBOGrabForeground and two examples > showing these in action.
nice, thank you! > 1.) In the class FBOBackground Gerrit has used the following > BlitFramebuffer statement in function clear: > > osgGlBlitFramebuffer( > 0, > 0, > _sfFrameBufferObject.getValue()->getWidth (), > _sfFrameBufferObject.getValue()->getHeight(), > pEnv->getPixelLeft (), > pEnv->getPixelBottom(), > pEnv->getPixelRight (), > pEnv->getPixelTop (), > (GL_COLOR_BUFFER_BIT | > GL_DEPTH_BUFFER_BIT | > GL_STENCIL_BUFFER_BIT), > GL_NEAREST); > > Is it not better to state the source points also from the pEnv > dimensions? I'm unsure here and would like to hear your opinion. My feeling here is that it is more intuitive to use the entire FBO contents by default. glBlitFramebuffer is capable of performing the rescaling if the sizes don't match. If really needed fields could be added to FBOBackground that describe the source region to use (the destination region is always given by the targeted viewport). > 2.) For experimentation I did put some clear buffer code into the > FBOBackground clear function. I have provided a modified FBOBackground > along with the new stuff in the attached zip file. In this source you > can activate the buffer clearing with define DEBUG_CLEAR_BACKGROUND. I assume that is meant purely for debugging purposes? I may well be missing something but outside of debugging I don't see a reason to clear the buffers we are about to overwrite with the blit? > With that in place and usage of the pEnv dimensions for source as well > as for destination of the blit operation I always get a one black pixel > seam at the top and the right of the rendered window (in both examples). > However, do I add one pixel to the top and right dimension, then the > rendered window seems to be ok. That can be done by enabling define > ADD_PLUS_ONE_TO_TOP_AND_RIGHT in both the FBOBackground (for example 1) > and FBOGrabForeground (for example 1 and 2) sources. Hmm, I think you found a bug there. glBlitFramebuffer takes x0,y0,x1,y1 with x1,y1 being exclusive, so I believe the +1 should be added. > I have inspected other places in OpenSG at where the pEnv->getPixelLeft > (),... calls are used and I found that at no place the additional pixels > were added. So I'm confused. What is correct and how to explain the > black edge in the window? If the additional pixel is correct, however, I > have to ask about the correctness of the other code places :-( On a quick spot check most of the places that use those dimensions pass the information to glViewport/glScissor which take x,y,width,height arguments and DrawEnv::getPixelWidth/getPixelHeight do the correct calculation of those. I'll check places where glBlitFramebuffer is used, since those seem the most likely to have a problem. > 3. Beside of these two points I would like to see the examples in OpenSG > and I would like to ask for some polishing or review. This is the first > foreground I have written and I'm still struggeling with the OpenGL > framebuffer object. I think the blit in FBOForeground should use the pEnv viewport dimensions as source (pEnv->getPixelLeft(), ..., pEnv->getPixelRight() +1, ...) and the entire FBO as destination (0,0, fbo->width, fbo->height). I'm holding off adding the FBOForeground and example so we can come to an agreement what values are best here. > For instance, I'm still unsure about the > implications of an multsampling render GL context of the window. I'm not sure what you are asking. To the extend that I understand it glBlitFramebuffer is capable of blitting between multisampled and single-sampled buffers (at the very least in the direction of multi -> single). So my hope would be that things "just work" - although there are probably some details I'm missing... ;) Cheers, Carsten ------------------------------------------------------------------------------ _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users