[osg-users] GLBeginEndAdapter

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Fri Jul 21 00:24:51 PDT 2017



Hi John,


> 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.)
The glBegin/End stuff is deprecated since OpenGL 2.0, which was released 
almost 13 Years ago, so it is long due.

The modern way is to use drawarrays. In your case it might be as simple 
as putting all the vertices into a vertex buffer and render it via a 
PimitiveSet using QUAD.

Take a look at the osggeometry-example. It covers all you need.
If you have detailed questions, feel free to consult the 
forum/mailing-list again.


Cheers
Sebastian

> 
> 
> 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
> 


More information about the osg-users mailing list