Re: [osg-users] Occlusion Query Node Error

2013-08-08 Thread Zach Basanese
Thanks for the help Paul.

When I look at OQN, in its draw implementation it will create the 
RetrieveQueryCallbacks (RQC) and ClearQueryCallbacks (CQC) if no post draw 
callbacks exist already.
However, we already have custom pre and post draw callbacks. Therefore, the 
required RQC and CQC don't get called. I'm not sure how to inheret RQC's 
functionallity into our own custom callbacks. RQC doesn't appear to be part of 
a namespace or accessible from a header file. Is there a way to inheret from 
RQC in our custom callbacks so that the dynamic cast in the draw implementation 
of OQN will work.

Once again, thanks in advance. I'm going to continue attemptin gto inheret in 
the mean time.

Zach


Paul Martz wrote:
> OcclusionQueryNode (OQN) has changed significantly since I contributed to 
> this effort, so I can only provide general advice.
> 
> OQN issues occlusion queries to OpenGL, and to avoid stalling the pipe, waits 
> until the Camera's post-draw callback to retrieve the query results. Then it 
> uses those results to determine what is visible in the next frame. 
> RetrieveQueriesCallback is the post-draw callback that is used to retrieve 
> the queries. For some reason, your Camera doesn't have such a callback 
> attached.
> 
> 
> I'd suggest searching the OSG source to see where RetrieveQueriesCallback is 
> attached to the Camera. I believe OQN was originally written to perform this 
> task automatically.
> 
> 
> It is also possible that you have attached some other Camera post-draw 
> callback. If so, you would need to take steps to ensure that both callbacks 
> are being executed.
> 
> 
> 
> On Wed, Aug 7, 2013 at 4:07 PM, Zach Basanese < ()> wrote:
> 
> >  Hello and thank you for any help in advance,
> > 
> > I am working with some code that a coworker had created, but is unavailable 
> > at the moment. It deals with Occlusion Query Nodes.
> > When we were still in OSG version 2.8, my coworker had grabbed a lot of the 
> > methods from the 3.0 version's OcclusionQueryNode.cpp and put them in our 
> > code so that we could use them for our sun. However, now that we have 
> > transitioned to 3.0, the code that was brought in isn't being used anymore, 
> > defaulting to OSG's code.
> > The issue is, whenever our sun is on screen, we are getting the following 
> > error now: "osgOQ: QG: Invalid RQCB."
> > This apparenlty happens becaues of this area of code:
> > 
> > Code:
> > 
> > RetrieveQueriesCallback* rqcb = dynamic_cast<
> > RetrieveQueriesCallback* >( cam->getPostDrawCallback() );
> > if (!rqcb)
> > {
> > OSG_FATAL << "osgOQ: QG: Invalid RQCB." << std::endl;
> > return;
> > }
> > 
> > 
> > 
> > I think it might be that we aren't setting up the nodes correctly, but I 
> > haven't been able to find any examples or documentation related to this 
> > error or how to properly set up occlusion query nodes in OSG.
> > Any help is appreciated, please let me know if you have any questions 
> > regarding my question.
> > 
> > Zach[/code]
> > 
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=55804#55804 
> > (http://forum.openscenegraph.org/viewtopic.php?p=55804#55804)
> > 
> > 
> > 
> > 
> > 
> > ___
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> 
> 
> 
> 
> -- 
> Paul Martz
> Skew Matrix Software LLC
> 
>  --
> Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55812#55812





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Occlusion Query Node Error

2013-08-08 Thread Paul Martz
OcclusionQueryNode (OQN) has changed significantly since I contributed to
this effort, so I can only provide general advice.

OQN issues occlusion queries to OpenGL, and to avoid stalling the pipe,
waits until the Camera's post-draw callback to retrieve the query results.
Then it uses those results to determine what is visible in the next frame.
RetrieveQueriesCallback is the post-draw callback that is used to retrieve
the queries. For some reason, your Camera doesn't have such a callback
attached.

I'd suggest searching the OSG source to see where RetrieveQueriesCallback
is attached to the Camera. I believe OQN was originally written to perform
this task automatically.

It is also possible that you have attached some other Camera post-draw
callback. If so, you would need to take steps to ensure that both callbacks
are being executed.


On Wed, Aug 7, 2013 at 4:07 PM, Zach Basanese wrote:

> Hello and thank you for any help in advance,
>
> I am working with some code that a coworker had created, but is
> unavailable at the moment. It deals with Occlusion Query Nodes.
> When we were still in OSG version 2.8, my coworker had grabbed a lot of
> the methods from the 3.0 version's OcclusionQueryNode.cpp and put them in
> our code so that we could use them for our sun. However, now that we have
> transitioned to 3.0, the code that was brought in isn't being used anymore,
> defaulting to OSG's code.
> The issue is, whenever our sun is on screen, we are getting the following
> error now: "osgOQ: QG: Invalid RQCB."
> This apparenlty happens becaues of this area of code:
>
> Code:
>
> RetrieveQueriesCallback* rqcb = dynamic_cast<
> RetrieveQueriesCallback* >( cam->getPostDrawCallback() );
> if (!rqcb)
> {
> OSG_FATAL << "osgOQ: QG: Invalid RQCB." << std::endl;
> return;
> }
>
>
>
> I think it might be that we aren't setting up the nodes correctly, but I
> haven't been able to find any examples or documentation related to this
> error or how to properly set up occlusion query nodes in OSG.
> Any help is appreciated, please let me know if you have any questions
> regarding my question.
>
> Zach[/code]
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=55804#55804
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Paul Martz
Skew Matrix Software LLC
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Intersection visitor and osg::Viewport

2013-08-08 Thread Aurelien Albert
Hi,

I've tried the following and it seems to solve my problem :


Code:
void IntersectionVisitor::apply(osg::Group& group)
{
if (!enter(group)) return;

osg::Viewport* pViewport = NULL;
if (group.getStateSet() != NULL)
{
pViewport = 
dynamic_cast(group.getStateSet()->getAttribute(osg::StateAttribute::VIEWPORT));
}

if (pViewport != NULL)
{
pushWindowMatrix(pViewport);
push_clone();
traverse(group);
pop_clone();
popWindowMatrix();
}
else
{
traverse(group);
}

leave();
}




This modification was just a test, but I wonder if this should not be in every 
"apply" method of IntersectionVisitor, maybe with these modifications :
- take care of the override value (do not push window matrix if the attribute 
is overriden)
- push the window matrix and the intersector clone BEFORE the "enter" test to 
ensure the "enter" test is done with correct coordinates frame

Or am I wrong with that and I've missed something ?

Thanks.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55809#55809





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Intersection visitor and osg::Viewport

2013-08-08 Thread Aurelien Albert
Hi,

I'm experiencing some problems to get correct intersections in following 
situation :

I have a group in my scene graph which have a Viewport StateAttribute to modify 
its rendering frame on screen.

All is works well for render, but intersector seems lost wih nodes below my 
group.

Is there any viewport change management in osg::Intersector ? I didn't find any 
(except when traversing camera).

Thank you!

Cheers,
Aurelien

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55808#55808





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] FBO PBO readPixels

2013-08-08 Thread Filip Arlet
Hi,

Can you give me an osg example of rendering to frame buffer object with camera 
postdraw callback and glReadPixels(); ?

I want to read from FBO with PBO and "double buffering", but 
glReadPixels(GL_COLOR_ATTACHMENT0); returns "invalid operation" even when I 
attach texture to camera.
Can it be done without Texture ? Using only osg::RenderBuffer ?

Thank you!

Cheers,
Filip

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55807#55807





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org