Hello Vincenzo,
Vincenzo Marafioti wrote:
> I used 29FBOTextures.cpp and add OpenGL occlusion query around render
> method of FBO. I have attached the source code, anyway I quote the
> display() function here:
>
> // redraw the window
> void display(void)
> {
> // get the current time
> Real32 t = OSG::getTimeStampMsecs(OSG::getTimeStamp()) * 0.001f;
>
> // animate flag
> animateFlag(t);
>
> // spin the fbo scene
> spinFBOScene(t);
>
> // get the RenderAction from SimpleSceneManager
> RenderAction *rAct = static_cast<RenderAction*>(::mgr->getAction());
>
> // render fbo scene
> glBeginQueryARB(GL_SAMPLES_PASSED_ARB, *_query);
> ::fboVP->render(rAct);
> glEndQueryARB(GL_SAMPLES_PASSED_ARB);
> //int available = 0;
> //do
> //{
> // glGetQueryObjectivARB( *_query, GL_QUERY_RESULT_AVAILABLE_ARB,
> &available );
> //} while( !available );
>
> int pixel = 0;
> glGetQueryObjectivARB(*_query, GL_QUERY_RESULT_ARB, &pixel);
> printf("%d\n", pixel);
>
>
> // render main scene
> ::mgr->redraw();
> }
>
> I need to get the number of passed fragments. Do you have clue how can I
> do? It seems that occlusion query does not work using a FboViewport,
> could you help me?
hm, I don't understand what is happening, if I put the OC query around
mgr->redraw() it works fine, but for the FBO it always returns 0.
Whether the FBO is rendered before or after the main scene does not make
a difference either (I thought perhaps a render target change would
reset the counters).
I've not used the glBeginQuery/glEndQuery stuff before and don't know if
there is some trick to use them with FBOs - the OpenGL spec does not
seem to say anything to that effect. Does anybody else here have an idea
what may be going on?
Cheers,
Carsten
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users