[osg-users] GLBeginEndAdapter

Robert Osfield robert.osfield at gmail.com
Fri Jul 21 01:16:41 PDT 2017


Hi John,

The GLBeginEndAdapter was an interim solution while older parts of the OSG
were migrated over to using vertex arrays and DrawArrays/DrawElements, once
this migration work was completed the core OSG no longer required it, so I
removed it to avoid bloat.  This migration work was required as OpenGL ES
and recent versions of OpenGL either don't support or deprecate
glBegin/glEnd, Further pressure to migrate was due to the need to support
Vertex Array Objects under recent versions of OpenGL and due to
peculiarities of OpenGL support under OSX.

For yourself migrating to use osg::Geometry may well be the easiest.
Sometimes this is straight forward, other times it can be a bit awkward as
not all glBegin/glEnd(() style usage easily maps to using vertex arrays.
It's worth the effort though as vertex arrays is how all modern graphics
hardware work, the GLBeginEndAdapter hides lots of hacky dynamic setting up
of vertex arrays internal to hide the difference between the old style and
how modern hardware manage things.

By moving away from GLBeginEndAdapter you have to confront just how best to
represent your data with modern vertex arrays but it'll be worth it - your
application should be faster for the improvement.

Robert.



On 20 July 2017 at 21:11, John Farrier <john.farrier at gmail.com> wrote:

> Hi,
>
> I am compiling some code with the current git repository version of OSG
> and found that State's "getGLBeginEndAdapter" has been removed.  Looking
> through the history, I see this happened at: commit
> e11e45a2e36de91bbe956223c43e8c5a50f9b72b.
>
> The comment is only "Removed GLBeginEndAdapter as it is no longer
> needed".  Well, my code seems to need it.  What do I need to do to update
> my code to not need it?  (I realize this is fixed pipeline code, but it's
> old code and it works.  So a complete re-write is not desirable.)
>
>
> Code:
> osg::GLBeginEndAdapter& gl = (state.getGLBeginEndAdapter());
>
> gl.Color4fv(_surfaceColor.ptr());
>
> bool drawBackSide = true;
> bool drawFrontSide = true;
>
> // draw back side.
> if(drawBackSide)
> {
>   for(int i = 0; i + 1 <= _density; i++)
>   {
>     const auto az1 = _azMin + (i*azIncr);
>     const auto az2 = _azMin + ((i + 1)*azIncr);
>
>     gl.Begin(GL_QUAD_STRIP);
>     for(int j = 0; j <= _density; j++)
>     {
>       ...
>
>
>
> Thank you!
>
> Cheers,
> John
> Code:
>
>
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=71289#71289
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170721/ce3c1d63/attachment.htm>


More information about the osg-users mailing list