Re: [Opensg-users] OpenSG 2: Setting up the depth buffer

2015-10-07 Thread Gerrit Voß

Hi,

On Tue, 2015-10-06 at 10:11 +0200, Johannes Brunen wrote:
> Hello,
> 
>  
> 
> I'm looking for a method to setup the depth buffer and possibly the
> stencil buffer befor starting rendering a viewport.
> 
>  
> 
> Suppose I have rendered a viewport with complex geometry into textures
> with a FBO. I know how to do that, but now I want to initialize the
> color and depth/stencil buffer from these textures  for rendering a
> second viewport. I have to render the second viewport a couple of times
> dynamically and won't render the first viewport in this situation.
> 
>  
> 
> Can this be done with OpenSG? Can anyone give me an outline of such a
> setup?

a passive background might help. It can take a clear callback
where you can do the blitting. Another option in there
is to blit the current framebuffer into an FBO (which is not directly
what you are looking for). Adding blitting from another FBO should not
be to difficult, well depending on how accurate the 'what to blit'
settings have to be. I'll have a look.

kind regards
  gerrit



--
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911=/4140
___
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users


Re: [Opensg-users] OpenSG 2: CMake build system

2015-10-07 Thread Johannes
On 06.10.2015 19:38, Gerrit Voß wrote:

> I have a look, currently all the file information is collected and
> temporarily stored. I would probably add a OSG_ADD_GLOBAL_EXE_SRC to
> have a distinction between libs and executables.
>
I'm fine with that :-)

Best,
Johannes




--
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911=/4140
___
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users


Re: [Opensg-users] OpenSG 2: Setting up the depth buffer

2015-10-07 Thread Gerrit Voß

Hi,

On Wed, 2015-10-07 at 13:55 +0200, Johannes wrote:
> On 07.10.2015 09:27, Gerrit Voß wrote:
> >
> > a passive background might help. It can take a clear callback
> > where you can do the blitting. Another option in there
> > is to blit the current framebuffer into an FBO (which is not directly
> > what you are looking for). Adding blitting from another FBO should not
> > be to difficult, well depending on how accurate the 'what to blit'
> > settings have to be. I'll have a look.
> >
> Great :-)
> 
> I'm also playing around with an example with a PolygonBackground, but I 
> have problems getting it to run. What I'm trying is to create a viewport
> with a PolygonBackground that is painting the texture image from a FBO 
> that I have rendered prior to that. In that simple setup the image is 
> rendered perfectly fine. However, when I add a shader program chunk to 
> the material of the PolygonBackground that shader code is never called.
> I debugged the relevant code places where GL_COMPILE_STATUS and 
> GL_LINK_STATUS is checked, but the example program did not stop at these 
> places. Additionally, I debugged the State::activate(...) function. The 
> TextureObjChunk, TextureEnvChunk and the MaterialChunk get activated but 
> not so the ShaderProgramChunk.
> 
> The poor man's idea with the shader is, that I can adapt the depth 
> buffer beside of the color buffer in the fragment shader.
> 
> Below you can find part of the example. Could you take a brief look? Is 
> shader code in the PolygonBackground forbidden generally? In case it 
> helps I can post or upload the complete example code.
> 
> 
> However, I would prefer some infrastructure that is easier to setup. 
> Maybe we could come up with a FancyBackground that takes a FBO and 
> manages the blitting (color, depth, stencil) internally. Especially, I 
> do not like a solution involving a shader in the first place.

that might be the best solution.

For your shader problem below, that is an old issue. It boils down to
shaders being cached during the traversal and remapped to a different
object. So the frontend objects does not do any actual OpenGL calls.
The easiest way around this is to use a SimpleSHLChunk instead if one
wants to activate the shader directly.

kind regards
  gerrit



--
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911=/4140
___
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users


Re: [Opensg-users] OpenSG 2: Setting up the depth buffer

2015-10-07 Thread Johannes
On 07.10.2015 14:52, Gerrit Voß wrote:
>
> For your shader problem below, ...
> The easiest way around this is to use a SimpleSHLChunk instead ...

I did not know about that one :-(

I took a look into the PassiveBackground implementation and it seems 
that it is quite near to what is needed here if I understand correctly.
If ClearFrameBufferObject is set and no ClearCallback is defined it does 
perform some blitting by

osgGlBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, 0)
osgGlBlitFramebuffer(
 pEnv->getPixelLeft (),
 pEnv->getPixelBottom(),
 pEnv->getPixelRight (),
 pEnv->getPixelTop (),
 pEnv->getPixelLeft (),
 pEnv->getPixelBottom(),
 pEnv->getPixelRight (),
 pEnv->getPixelTop (),
 (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT),
 GL_NEAREST);

osgGlBindFramebuffer(
 GL_READ_FRAMEBUFFER_EXT,
 win->getGLObjectId(pEnv->getActiveFBO()));


Am I correct that this blit from the main render buffer into the active FBO?


Assume that we store the FBO into the FancyBackground. How do we do the 
opposite blit operation?

glBindFramebuffer(GL_READ_FRAMEBUFFER, my_fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);

glReadBuffer(GL_COLOR_ATTACHMENT0);
glDrawBuffer(GL_COLOR_ATTACHMENT0);

osgGlBlitFramebuffer(
 pEnv->getPixelLeft (),
 pEnv->getPixelBottom(),
 pEnv->getPixelRight (),
 pEnv->getPixelTop (),
 pEnv->getPixelLeft (),
 pEnv->getPixelBottom(),
 pEnv->getPixelRight (),
 pEnv->getPixelTop (),
 (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT),
 GL_NEAREST);

What is my_fbo actually, i.e. where do I get the id of the stored FBO?

I have no experience with GL framebuffer handling, so any hints are 
welcomed.

Best,
Johannes






--
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911=/4140
___
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users


Re: [Opensg-users] OpenSG 2: CMake build system

2015-10-07 Thread Gerrit Voß

Hi,

On Wed, 2015-10-07 at 08:41 +0200, Johannes wrote:
> On 06.10.2015 19:38, Gerrit Voß wrote:
> 
> > I have a look, currently all the file information is collected and
> > temporarily stored. I would probably add a OSG_ADD_GLOBAL_EXE_SRC to
> > have a distinction between libs and executables.
> >
> I'm fine with that :-)

great ;), just commited the change, so now you can use
OSG_ADD_GLOBAL_EXE_SRC
to add extra source files to each executable.

I'll look at the background tomorrow.

kind regards
  gerrit



--
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911=/4140
___
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users