[osg-users] [build] Build Issues Trunk 2.9.12 and GL3

Peter Wrobrl ParticlePeter at gmx.de
Fri Apr 1 09:35:25 PDT 2011


Hi,

there are Build Issues with the current Trunk and the GL3 Option

osgText does not build due to glPushAttrib / glPopAttrib in Text::renderWithDelayedDepthWrites. 
osgSim OverlayNode Serializer uses Deprecated glTexEnv GL_DECAL Enum.




Fix for Text::renderWithDelayedDepthWrites:

void Text::renderWithDelayedDepthWrites(osg::State& state, const osg::Vec4& colorMultiplier) const
{
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
    glPushAttrib( _enableDepthWrites ? (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) : GL_DEPTH_BUFFER_BIT);
    // Render to color buffer without writing to depth buffer.
    glDepthMask(GL_FALSE);
    drawTextWithBackdrop(state,colorMultiplier);

    // Render to depth buffer if depth writes requested.
    if( _enableDepthWrites )
    {
        glDepthMask(GL_TRUE);
        glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
        drawTextWithBackdrop(state,colorMultiplier);
    }
    glPopAttrib();

#else
	OSG_NOTICE << "Warning: Text::renderWithDelayedDepthWrites(..) not implemented." << std::endl ;
#endif
}



Fix for osgSim::OverlayNode Serializer ( not sure if this one is sufficient, but works )

#include <osgSim/OverlayNode>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>

REGISTER_OBJECT_WRAPPER( osgSim_OverlayNode,
                         new osgSim::OverlayNode,
                         osgSim::OverlayNode,
                         "osg::Object osg::Node osg::Group osgSim::OverlayNode" )
{
    BEGIN_ENUM_SERIALIZER( OverlayTechnique, OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY );
        ADD_ENUM_VALUE( OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY );
        ADD_ENUM_VALUE( VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY );
        ADD_ENUM_VALUE( VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY );
    END_ENUM_SERIALIZER();  // _overlayTechnique
    
    ADD_OBJECT_SERIALIZER( OverlaySubgraph, osg::Node, NULL );  // _overlaySubgraph
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
    ADD_GLENUM_SERIALIZER( TexEnvMode, GLenum, GL_DECAL );  // _texEnvMode
#endif
    ADD_UINT_SERIALIZER( OverlayTextureUnit, 1 );  // _textureUnit
    ADD_UINT_SERIALIZER( OverlayTextureSizeHint, 1024 );  // _textureSizeHint
    ADD_VEC4_SERIALIZER( OverlayClearColor, osg::Vec4() );  // _overlayClearColor
    ADD_BOOL_SERIALIZER( ContinuousUpdate, false );  // _continuousUpdate
    ADD_DOUBLE_SERIALIZER( OverlayBaseHeight, -100.0 );  // _overlayBaseHeight
}




Moreover, think it would be a good Idea to add an Option to CMakeLists whether to build osgQT, as QT includes GL.h. No fix for that :-)



For completeness, this Thread explains how to build OSG with GL3 option on Windows ( tweak of osg/GL , tweak of CMakeLists.txt ) :
http://forum.openscenegraph.org/viewtopic.php?t=7322




Cheers,
ParticlePeter

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








More information about the osg-users mailing list