[osg-users] R: glFlush and osg

Gianluca Natale natale at europe.altair.com
Tue Apr 19 08:39:56 PDT 2011

Thanks Robert,
I'll try to replace my drawables with those provided by osg.


-----Messaggio originale-----
Da: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-bounces at lists.openscenegraph.org] Per conto di Robert Osfield
Inviato: martedì 19 aprile 2011 17:26
A: OpenSceneGraph Users
Oggetto: Re: [osg-users] glFlush and osg

Hi Gianluca,

There isn't much we can probably suggest given you are using a custom
Drawable implementation.

General comments would be that glFlush shouldn't affect the quality of
the results, only the speed at which handled.  Using glFlush forces
the GL driver to pause the application thread calling GL to wait until
all the commands and data in GL drivers' fifo buffer have been passed
to the graphics card.  glFlush doesn't itself change any OpenGL state
so in principle should not effect results.

Given glFlush shouldn't have the effect you are describing perhaps
it's just co-incidence and that a threading issue in your application
is causing problems.

I would also suggest replacing your custom Drawable with code based on
osg::Geometry, this may or may not be possible, but trying this would
at least
give you a test using code that others have access to, and is known to work.


On Tue, Apr 19, 2011 at 4:03 PM, Gianluca Natale
<natale at europe.altair.com> wrote:
> Hi there,
> I have an issue with glFlush, and I don't know exactly if this is related to
> OSG.
> Basically, I have a very complicated scenegraph, whose drawables are my own
> classes
> derived from osg::drawable. So, they implement the drawImplementation, by
> using standard
> OpenGL rendering commands (basically vertex arrays).
> I had to put a glFlush() at the end of each drawImplmentation() to make it
> work correctly.
> I mean that, if I didn't, the drawing would be completely wrong, as if wrong
> normals were applied
> to lighting computations. But glFlush() should only flush the content of the
> command buffer to the graphic board.
> Am I worng?
> Furthermore, it does not behave wrongly on every graphic board, only some
> cards shows the problem
> (mine is a nVidia Quadro FX 2500M).
> What's even worse is that putting such calls slows down my application a lot
> (from 22 to 13 fps).
> So, I just wonder if it might be a problem related to OSG (since I mixed osg
> with direct OpenGL commands),
> or if it might be related to specific drivers of my graphic board.
> Thanks in advance,
> Gianluca
> P.S. = BTW, if I replaced glFlush() with a double call to glPointSize(),
> passing 3.0 and 1.0 in sequence as sizes
>            (but without making any other call inbetween). It still works
> good, as if glFlush() was issued, but without the
>            side effect of slowness. So, actually they act as a glFlush() in
> my code!
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
osg-users mailing list
osg-users at lists.openscenegraph.org

More information about the osg-users mailing list