Jannik Heller | 20 Aug 14:39 2015
Picon

Re: Multiple camera frame break improvement

Hi Robert,

sorry for bumping this. Now that the OSG-3.4 stable release is out of the way, do you think it might be a good
time to start reviewing and integrating this patch?

Is there anyway I can help further in ensuring that the patch is solid?

Cheers,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64848#64848
Björn Blissing | 18 Aug 13:43 2015
Picon

MSVC warnings in osgDB::OutputStream

Hi,

Since 3.4.0 I get a lot of warnings from line 148, 149, 153 & 154 in osgDB::OutputStreamer:

Code:
OutputStream& operator<<( const osg::Array* a ) { if (OPENSCENEGRAPH_SOVERSION>=112)
writeObject(a); else writeArray(a); return *this; }
OutputStream& operator<<( const osg::PrimitiveSet* p ) { if (OPENSCENEGRAPH_SOVERSION>=112)
writeObject(p); else writePrimitiveSet(p); return *this; }

...

OutputStream& operator<<( const osg::ref_ptr<osg::Array>& ptr ) { if
(OPENSCENEGRAPH_SOVERSION>=112) writeObject(ptr.get()); else writeArray(ptr.get()); return
*this; }
OutputStream& operator<<( const osg::ref_ptr<osg::PrimitiveSet>& ptr ) { if
(OPENSCENEGRAPH_SOVERSION>=112) writeObject(ptr.get()); else writePrimitiveSet(ptr.get());
return *this; }

The warning is: warning C4127: conditional expression is constant

This warning id is not among the ones suppressed inside the osgDB::Export header.

I have added this warning to the list of suppressed warnings if OSG_DISABLE_MSVC_WARNINGS is defined.

Best regards
Björn

------------------
Read this topic online here:
(Continue reading)

Dmitry Marakasov | 13 Aug 18:29 2015
Picon

gstreamer detection broken in 3.4.0, please revert r14984

Hi!

Subj. While before this commit it successfully used pkg-config hints
to correctly detect paths to both includes and libraries out of
box, now it doesn't build at least on FreeBSD as pkg-config provides
library flag -lgstreamer, but not link paths to search for it for
(-L/usr/local/lib in my case). While you could actually use link paths
from pkg-config as well, former approach which uses global library
paths is much more simple, clean and correct.

--

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@...  ..:  jabber:
amdmi3@...      http://amdmi3.ru
Julien Valentin | 12 Aug 23:01 2015
Picon

little bug in osg::Geometry

Hi,
Serializing custom geometry i ran into a crash due to a 
setVertexAttribArrayList(array) with array containing NULL vertexAttrib.
I added a test in order to avoid it

Code:
void Geometry::setVertexAttribArrayList(const ArrayList& arrayList)
{
    _vertexAttribList = arrayList;

    dirtyDisplayList();

    if (_useVertexBufferObjects)
    {
        for(ArrayList::iterator itr = _vertexAttribList.begin();
            itr != _vertexAttribList.end();
            ++itr)
        {
if(itr->get())//ADDED
            addVertexBufferObjectIfRequired(itr->get());
        }
    }
} 

Thank you!

Cheers,
Julien

------------------
(Continue reading)

Julien Valentin | 8 Aug 16:54 2015
Picon

[Callback serialization] virtual inheritance of osg::CallBackObject removal

Hi,
I played for a while with osg::ScriptNodeCallback and ran into the serialization problem of
osg::Callback derivated classes.

It seams that the serialization metamodel have problems with virtual inheritance.

With a little of hacking i achieve to serialize ScriptNodeCallback 
- I removed the virtual osgCallback inheriatnce of osg::CallbackObject 
-And modify the inheritance of ScriptNodeCallback from NodeCallBack

(The maindifference with current code is that one cannot get the engine
from the nodepath anymore)

I would be glad to post my code, but first I would like to know if changing virtual inheritance of
CallBackObject would breaks osg features I haven't in mind;

Thank you!

Cheers,
Julien

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64670#64670
Glenn Waldron | 7 Aug 22:07 2015
Picon

Possible error in ZIP plugin

Robert,

Sorry I don't have time to test a fix immediately (not up to date with the repo) but this looks like a bug:


Should be

  else if ( !_membuffer.empty() )

Thanks. :)

Glenn Waldron / <at> glennwaldron
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Andy Skinner | 31 Jul 22:40 2015
Picon

Avoid use of older symbol in osgViewer.cpp

Someone was using our code on a system that does not seem to have the SGIX symbols used in osgViewer.cpp.

 

I used osgSetGLExtensionsFuncPtr to remove the symbols.  I don't know how to test this path, but it did remove the symbols from libosgViewer.so.  I have also not been able yet to see if that was sufficient for our customer.

 

I did this by looking at other cases, and I tried to follow some of the same practices in PixelBufferX11, like using _useSGIX in a similar way to the previous _useGLX1_3.

 

I don't know whether this is the right thing, or whether it would be fine to remove this code and replace with more modern.

 

Advice appreciated.

 

I originally made these changes in an older version, but these files were based off of the trunk from the SVN repository.

 

thanks

andy

 

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
*/

/* Note, elements of PixelBufferX11 have used Prodcer/RenderSurface_X11.cpp as both
 * a guide to use of X11/GLX and copiying directly in the case of setBorder().
 * These elements are license under OSGPL as above, with Copyright (C) 2001-2004  Don Burns.
 */

#include <osgViewer/api/X11/PixelBufferX11>
#include <osgViewer/api/X11/GraphicsWindowX11>
#include <osg/GLExtensions>

#include <X11/Xlib.h>

#include <unistd.h>

using namespace osgViewer;

PixelBufferX11::PixelBufferX11(osg::GraphicsContext::Traits* traits)
  : _valid(false),
    _pbuffer(0),
    _visualInfo(0),
    _initialized(false),
    _realized(false),
    _useGLX1_3(false),
    _useSGIX(false),
    _glXCreateGLXPbufferSGIX(NULL),
    _glXDestroyGLXPbufferSGIX(NULL),
    _glXQueryGLXPbufferSGIX(NULL),
    _glXGetFBConfigFromVisualSGIX(NULL)
{
    _traits = traits;

    init();

    if (valid())
    {
        setState( new osg::State );
        getState()->setGraphicsContext(this);

        if (_traits.valid() && _traits->sharedContext.valid())
        {
            getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
            incrementContextIDUsageCount( getState()->getContextID() );
        }
        else
        {
            getState()->setContextID( osg::GraphicsContext::createNewContextID() );
        }

    }
}

PixelBufferX11::~PixelBufferX11()
{
    close(true);
}

#if defined(GLX_VERSION_1_3) || defined(GLX_SGIX_pbuffer)
bool PixelBufferX11::createVisualInfo()
{
    typedef std::vector<int> Attributes;
    Attributes attributes;

    attributes.push_back(GLX_USE_GL);

    attributes.push_back(GLX_RGBA);

    if (_traits->doubleBuffer) attributes.push_back(GLX_DOUBLEBUFFER);

    attributes.push_back(GLX_RED_SIZE); attributes.push_back(_traits->red);
    attributes.push_back(GLX_GREEN_SIZE); attributes.push_back(_traits->green);
    attributes.push_back(GLX_BLUE_SIZE); attributes.push_back(_traits->blue);
    attributes.push_back(GLX_DEPTH_SIZE); attributes.push_back(_traits->depth);

    if (_traits->alpha) { attributes.push_back(GLX_ALPHA_SIZE);
attributes.push_back(_traits->alpha); }

    if (_traits->stencil) { attributes.push_back(GLX_STENCIL_SIZE);
attributes.push_back(_traits->stencil); }

#if defined(GLX_SAMPLE_BUFFERS) && defined (GLX_SAMPLES)

    if (_traits->sampleBuffers) { attributes.push_back(GLX_SAMPLE_BUFFERS);
attributes.push_back(_traits->sampleBuffers); }
    if (_traits->sampleBuffers) { attributes.push_back(GLX_SAMPLES);
attributes.push_back(_traits->samples); }

#endif
    // TODO
    //  GLX_AUX_BUFFERS
    //  GLX_ACCUM_RED_SIZE
    //  GLX_ACCUM_GREEN_SIZE

    attributes.push_back(None);

    _visualInfo = glXChooseVisual( _display, _traits->screenNum, &(attributes.front()) );

    return _visualInfo != 0;
}

void PixelBufferX11::init()
{
    if (_initialized) return;

    if (!_traits)
    {
        _valid = false;
        return;
    }

    if (_traits->target != 0)
    {
        // we don't support Pbuffer render to texture under GLX.
        _valid = false;
        return;
    }

    _display = XOpenDisplay(_traits->displayName().c_str());

    unsigned int screen = _traits->screenNum;

    if (!_display)
    {
        OSG_NOTICE<<"Error: Unable to open display \"" << XDisplayName(_traits->displayName().c_str()) << "\"."<<std::endl;
        _valid = false;
        return;
    }

    // Query for GLX extension
    int errorBase, eventBase;
    if( glXQueryExtension( _display, &errorBase, &eventBase)  == False )
    {
        OSG_NOTICE<<"Error: " << XDisplayName(_traits->displayName().c_str()) <<" has no GLX extension." << std::endl;

        XCloseDisplay( _display );
        _display = 0;
        _valid = false;
        return;
    }

    // OSG_NOTICE<<"GLX extension, errorBase="<<errorBase<<" eventBase="<<eventBase<<std::endl;

    int major, minor;
    if (glXQueryVersion(_display, &major, &minor) == False)
    {
        OSG_NOTICE << "Error: " << XDisplayName(_traits->displayName().c_str())
                                 << " can not query GLX version." << std::endl;
        XCloseDisplay( _display );
        _display = 0;
        _valid = false;
        return;
    }

    // Just be paranoid, if we are older than 1.1, we cannot even call glxQueryExtensionString
    if (major < 1 || (1 == major && minor < 1))
    {
        OSG_NOTICE << "Error: " << XDisplayName(_traits->displayName().c_str())
                                 << " GLX version " << major << "." << minor << " is too old." << std::endl;
        XCloseDisplay( _display );
        _display = 0;
        _valid = false;
        return;
    }

    bool haveGLX1_3 = false;
    bool haveSGIX_pbuffer = false;

    // We need to have at least GLX 1.3 to use getFBConfigFromVisual and glXCreatePbuffer
    if (1 < major || (1 == major && 3 <= minor))
    {
        haveGLX1_3 = true;
    }

#if defined(GLX_VERSION_1_1)
    // We need at least GLX 1.1 for glXQueryExtensionsString
    if (!haveGLX1_3 && 1 <= minor)
    {
        const char *extensions = glXQueryExtensionsString(_display, screen);
        haveSGIX_pbuffer = osg::isExtensionInExtensionString("GLX_SGIX_pbuffer", extensions)
           && osg::isExtensionInExtensionString("GLX_SGIX_fbconfig", extensions);

        if (haveSGIX_pbuffer)
        {
            osg::setGLExtensionFuncPtr(_glXCreateGLXPbufferSGIX, "glXDestroyGLXPbufferSGIX");
            osg::setGLExtensionFuncPtr(_glXDestroyGLXPbufferSGIX, "glXDestroyGLXPbufferSGIX");
            osg::setGLExtensionFuncPtr(_glXQueryGLXPbufferSGIX, "glXDestroyGLXPbufferSGIX");
            osg::setGLExtensionFuncPtr(_glXGetFBConfigFromVisualSGIX, "glXGetFBConfigFromVisualSGIX");
            if (_glXCreateGLXPbufferSGIX == NULL ||
                _glXDestroyGLXPbufferSGIX == NULL ||
                _glXQueryGLXPbufferSGIX == NULL ||
                _glXGetFBConfigFromVisualSGIX == NULL) {
                haveSGIX_pbuffer = false;
            }
        }
    }
#endif

    if (!haveGLX1_3 && !haveSGIX_pbuffer)
    {
        OSG_NOTICE << "Error: " << XDisplayName(_traits->displayName().c_str())
                                 << " no Pbuffer support in GLX available." << std::endl;
        XCloseDisplay( _display );
        _display = 0;
        _valid = false;
        return;
    }

    if (!createVisualInfo())
    {
        _traits->red /= 2;
        _traits->green /= 2;
        _traits->blue /= 2;
        _traits->alpha /= 2;
        _traits->depth /= 2;

        OSG_INFO<<"Relaxing traits"<<std::endl;

        if (!createVisualInfo())
        {
            OSG_NOTICE<<"Error: Not able to create requested visual." << std::endl;
            XCloseDisplay( _display );
            _display = 0;
            _valid = false;
            return;
        }
    }

    // get any shared GLX contexts
    GraphicsHandleX11* graphicsHandleX11 = dynamic_cast<GraphicsHandleX11*>(_traits->sharedContext.get());
    Context sharedContext = graphicsHandleX11 ? graphicsHandleX11->getContext() : 0;

    _context = glXCreateContext( _display, _visualInfo, sharedContext, True );

    if (!_context)
    {
        OSG_NOTICE<<"Error: Unable to create OpenGL graphics context."<<std::endl;
        XCloseDisplay( _display );
        _display = 0;
        _valid = false;
        return;
    }

#ifdef GLX_VERSION_1_3
    // First try the regular glx extension if we have a new enough version available.
    if (haveGLX1_3)
    {
        int nelements;
        GLXFBConfig *fbconfigs = glXGetFBConfigs( _display, screen, &nelements );
        for ( int i = 0; i < nelements; ++i )
        {
            int visual_id;
            if ( glXGetFBConfigAttrib( _display, fbconfigs[i], GLX_VISUAL_ID, &visual_id ) == 0 )
            {
                if ( !_pbuffer && (unsigned int)visual_id == _visualInfo->visualid )
                {
                    typedef std::vector <int> AttributeList;

                    AttributeList attributes;
                    attributes.push_back( GLX_PBUFFER_WIDTH );
                    attributes.push_back( _traits->width );
                    attributes.push_back( GLX_PBUFFER_HEIGHT );
                    attributes.push_back( _traits->height );
                    attributes.push_back( GLX_LARGEST_PBUFFER );
                    attributes.push_back( GL_TRUE );
                    attributes.push_back( 0L );

                    _pbuffer = glXCreatePbuffer(_display, fbconfigs[i], &attributes.front() );
                    _useGLX1_3 = true;
                }
            }
        }
        if (_pbuffer)
        {
            int iWidth = 0;
            int iHeight = 0;
            glXQueryDrawable(_display, _pbuffer, GLX_WIDTH  , (unsigned int *)&iWidth);
            glXQueryDrawable(_display, _pbuffer, GLX_HEIGHT , (unsigned int *)&iHeight);

            if (_traits->width != iWidth || _traits->height != iHeight)
            {
                OSG_NOTICE << "PixelBufferX11::init(), pbuffer created with different size then requsted" << std::endl;
                OSG_NOTICE << "\tRequested size (" << _traits->width << "," << _traits->height << ")" << std::endl;
                OSG_NOTICE << "\tPbuffer size (" << iWidth << "," << iHeight << ")" << std::endl;
                _traits->width  = iWidth;
                _traits->height = iHeight;
            }
        }
        XFree( fbconfigs );
    }
#endif

#ifdef GLX_SGIX_pbuffer
    // If we still have no pbuffer but a capable display with the SGIX extension, try to use that
    if (!_pbuffer && haveSGIX_pbuffer)
    {
        GLXFBConfigSGIX fbconfig = _glXGetFBConfigFromVisualSGIX( _display, _visualInfo );
        typedef std::vector <int> AttributeList;

        AttributeList attributes;
        attributes.push_back( GLX_LARGEST_PBUFFER_SGIX );
        attributes.push_back( GL_TRUE );
        attributes.push_back( 0L );

        _pbuffer = _glXCreateGLXPbufferSGIX(_display, fbconfig, _traits->width, _traits->height, 
&attributes.front() );
        if (_pbuffer)
        {
            _useSGIX = true;
            int iWidth = 0;
            int iHeight = 0;
            _glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_WIDTH_SGIX , (unsigned int *)&iWidth);
            _glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_HEIGHT_SGIX, (unsigned int *)&iHeight);

            if (_traits->width != iWidth || _traits->height != iHeight)
            {
                OSG_NOTICE << "PixelBufferX11::init(), SGIX_pbuffer created with different size then requsted" << std::endl;
                OSG_NOTICE << "\tRequested size (" << _traits->width << "," << _traits->height << ")" << std::endl;
                OSG_NOTICE << "\tPbuffer size (" << iWidth << "," << iHeight << ")" << std::endl;
                _traits->width =  iWidth;
                _traits->height = iHeight;
            }
        }
        XFree( fbconfig );
    }
#endif

    if (!_pbuffer)
    {
        OSG_NOTICE<<"Error: Unable to create pbuffer."<<std::endl;
        XCloseDisplay( _display );
        _display = 0;
        _context = 0;
        _valid = false;
        return;
    }

    XFlush( _display );
    XSync( _display, 0 );

    _valid = true;
    _initialized = true;
}

void PixelBufferX11::closeImplementation()
{
    // OSG_NOTICE<<"Closing PixelBufferX11"<<std::endl;
    if (_display)
    {
        if (_context)
        {
            glXDestroyContext(_display, _context );
        }

        if (_pbuffer)
        {
            if (_useGLX1_3)
            {
#ifdef GLX_VERSION_1_3
                glXDestroyPbuffer(_display, _pbuffer);
#endif
            }
            else
            {
#ifdef GLX_SGIX_pbuffer
                if (_useSGIX)
                {
                    _glXDestroyGLXPbufferSGIX(_display, _pbuffer);
                }
#endif
            }
        }

        XFlush( _display );
        XSync( _display,0 );
    }

    _pbuffer = 0;
    _context = 0;

    if (_visualInfo)
    {
        XFree(_visualInfo);
        _visualInfo = 0;
    }

    if (_display)
    {
        XCloseDisplay( _display );
        _display = 0;
    }

    _initialized = false;
    _realized = false;
    _valid = false;
}

#else

// fallback for non GLX1.3 versions where pbuffers are not supported.
// note, this makes the rest of the pbuffer code a non op as init is false;
bool PixelBufferX11::createVisualInfo()
{
    return false;
}

void PixelBufferX11::init()
{
}

void PixelBufferX11::closeImplementation()
{
    // OSG_NOTICE<<"Closing PixelBufferX11"<<std::endl;
    _pbuffer = 0;
    _context = 0;
    _initialized = false;
    _realized = false;
    _valid = false;
}

#endif

bool PixelBufferX11::realizeImplementation()
{
    if (_realized)
    {
        OSG_NOTICE<<"PixelBufferX11::realizeImplementation() Already realized"<<std::endl;
        return true;
    }

    if (!_initialized) init();

    if (!_initialized) return false;

    _realized = true;

    return true;
}

bool PixelBufferX11::makeCurrentImplementation()
{
    if (!_realized)
    {
        OSG_NOTICE<<"Warning: GraphicsWindow not realized, cannot do makeCurrent."<<std::endl;
        return false;
    }

    // OSG_NOTICE<<"PixelBufferX11::makeCurrentImplementation "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl;

    #ifdef OSG_USE_EGL
        return eglMakeCurrent(_display, _pbuffer, _pbuffer, _context)==EGL_TRUE;
    #else
        return glXMakeCurrent( _display, _pbuffer, _context )==True;
    #endif
}

bool PixelBufferX11::makeContextCurrentImplementation(osg::GraphicsContext* /*readContext*/)
{
    // OSG_NOTICE<<"PixelBufferX11::makeContextCurrentImplementation() not implementation yet."<<std::endl;
    return makeCurrentImplementation();
}

bool PixelBufferX11::releaseContextImplementation()
{
    if (!_realized)
    {
        OSG_NOTICE<<"Warning: GraphicsWindow not realized, cannot do makeCurrent."<<std::endl;
        return false;
    }

    // OSG_NOTICE<<"PixelBufferX11::releaseContextImplementation() "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl;

    #ifdef OSG_USE_EGL
        return eglMakeCurrent( _display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT )==EGL_TRUE;
    #else
        return glXMakeCurrent( _display, None, NULL )==True;
    #endif
}

void PixelBufferX11::bindPBufferToTextureImplementation(GLenum /*buffer*/)
{
    OSG_NOTICE<<"PixelBufferX11::bindPBufferToTextureImplementation() not implementation yet."<<std::endl;
}

void PixelBufferX11::swapBuffersImplementation()
{
    if (!_realized) return;

    // OSG_NOTICE<<"PixelBufferX11::swapBuffersImplementation "<<this<<" "<<OpenThreads::Thread::CurrentThread()<<std::endl;

    #ifdef OSG_USE_EGL
        eglSwapBuffers( _display, _pbuffer );
    #else
        glXSwapBuffers( _display, _pbuffer );
    #endif
}
Attachment (PixelBufferX11): application/octet-stream, 5115 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Kristofer Tingdahl | 29 Jul 12:03 2015

Patch to solve compiler warnings

Dear Robert,


I started our first build of the 3.4 branch, and I got a number of compiler warnings which are fixed by attached diff.

Apart from the casts that are made explicit, I added a virtual destructor in the TextGlyph class. Since it has virtual functions, I think it should have a virtual destructor as you cannot control what will happen in inheriting implementations of the virtual functions, and you need to give the developer of inheriting classes the freedom to implement a destructor. Another solution would be to make all functions non-virtual.

This patch is also directly applicable in the trunk without modifications.

With this patch, I get a flawless compile of the code.


Cheers,

Kristofer

--
Dr. Kristofer Tingdahl
Chief Executive Officer
______________________________

dGB Earth Sciences
Phone: +31 53 4315155
Skype: dgbtingdahl
E-mail: kristofer.tingdahl <at> dgbes.com
Internet: dgbes.com & opendtect.org
______________________________

Index: include/osgText/Text
===================================================================
--- include/osgText/Text	(revision 15027)
+++ include/osgText/Text	(working copy)
 <at>  <at>  -318,6 +318,7  <at>  <at> 

         GlyphQuads();
         GlyphQuads(const GlyphQuads& gq);
+	virtual ~GlyphQuads() { }

         void initGlyphQuads();
         void initGPUBufferObjects();
Index: src/osg/Image.cpp
===================================================================
--- src/osg/Image.cpp	(revision 15027)
+++ src/osg/Image.cpp	(working copy)
 <at>  <at>  -1950,13 +1950,13  <at>  <at> 
     switch(pixelFormat)
     {
     case(GL_DEPTH_COMPONENT):   //intentionally fall through and execute the code for GL_LUMINANCE
-    case(GL_LUMINANCE):         { (*data++) = c[0] * scale; } break;
-    case(GL_ALPHA):             { (*data++) = c[3] * scale; } break;
-    case(GL_LUMINANCE_ALPHA):   { (*data++) = c[0] * scale;  (*data++) = c[3] * scale; } break;
-    case(GL_RGB):               { (*data++) = c[0] *scale; (*data++) = c[1] *scale; (*data++) = c[2] *scale;} break;
-    case(GL_RGBA):              { (*data++) = c[0] *scale; (*data++) = c[1] *scale; (*data++) = c[2] *scale; (*data++) =
c[3] *scale;} break;
-    case(GL_BGR):               { (*data++) = c[2] *scale; (*data++) = c[1] *scale; (*data++) = c[0] *scale;} break;
-    case(GL_BGRA):              { (*data++) = c[2] *scale; (*data++) = c[1] *scale; (*data++) = c[0] *scale; (*data++) =
c[3] *scale;} break;
+    case(GL_LUMINANCE):         { (*data++) = (T)(c[0] * scale); } break;
+    case(GL_ALPHA):             { (*data++) = (T)(c[3] * scale); } break;
+    case(GL_LUMINANCE_ALPHA):   { (*data++) = (T)(c[0] * scale);  (*data++) = (T)(c[3] * scale); } break;
+    case(GL_RGB):               { (*data++) = (T)(c[0] *scale); (*data++) = (T)(c[1] *scale); (*data++) = (T)(c[2]
*scale);} break;
+    case(GL_RGBA):              { (*data++) = (T)(c[1] *scale); (*data++) = (T)(c[1] *scale); (*data++) = (T)(c[2]
*scale); (*data++) = (T)(c[3] *scale);} break;
+    case(GL_BGR):               { (*data++) = (T)(c[2] *scale); (*data++) = (T)(c[1] *scale); (*data++) = (T)(c[0]
*scale);} break;
+    case(GL_BGRA):              { (*data++) = (T)(c[2] *scale); (*data++) = (T)(c[1] *scale); (*data++) = (T)(c[0]
*scale); (*data++) = (T)(c[3] *scale);} break;
     }

 }
Index: src/osgPlugins/3ds/ReaderWriter3DS.cpp
===================================================================
--- src/osgPlugins/3ds/ReaderWriter3DS.cpp	(revision 15027)
+++ src/osgPlugins/3ds/ReaderWriter3DS.cpp	(working copy)
 <at>  <at>  -1340,7 +1340,7  <at>  <at> 
             // rebuild the texture with alpha channel (rescale according to map amount)
             for (int i=0, j=0; i<n; i+=4, j+=nc)
             {
-                img_data[i] = img_data[i+1] = img_data[i+2] = img_data[i+3] = one_minus_factor + orig_img_data[j]*factor;
+                img_data[i] = img_data[i+1] = img_data[i+2] = img_data[i+3] = (unsigned char)(one_minus_factor + orig_img_data[j]*factor);
             }
             osg_image->setImage(osg_image->s(),osg_image->t(),osg_image->r(), GL_RGBA, GL_RGBA,
GL_UNSIGNED_BYTE, img_data, osg::Image::USE_NEW_DELETE);
             opacity_map->setImage(osg_image.get());
Index: src/osgPlugins/lua/LuaScriptEngine.cpp
===================================================================
--- src/osgPlugins/lua/LuaScriptEngine.cpp	(revision 15027)
+++ src/osgPlugins/lua/LuaScriptEngine.cpp	(working copy)
 <at>  <at>  -140,7 +140,7  <at>  <at> 
             osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
             if (vs)
             {
-                const void* dataPtr = vs->getElement(*object, index);
+                const void* dataPtr = vs->getElement(*object, (unsigned int) index);
                 if (dataPtr)
                 {
                     SerializerScratchPad valuesp(vs->getElementType(), dataPtr, vs->getElementSize());
 <at>  <at>  -191,7 +191,7  <at>  <at> 
                 SerializerScratchPad ssp;
                 lse->getDataFromStack(&ssp, vs->getElementType(), 3);
                 {
-                    vs->setElement(*object, index, ssp.data);
+                    vs->setElement(*object, (unsigned int) index, ssp.data);
                 }
             }
             return 0;
 <at>  <at>  -3808,7 +3808,7  <at>  <at> 
     {
         for(unsigned int c=0; c<4; ++c)
         {
-            lua_pushnumber(_lua, r*4+c); lua_pushinteger(_lua, value(r,c)); lua_settable(_lua, -3);
+            lua_pushnumber(_lua, r*4+c); lua_pushinteger(_lua, (lua_Integer) value(r,c));
lua_settable(_lua, -3);
         }
     }
 }
Index: src/osgViewer/ViewerEventHandlers.cpp
===================================================================
--- src/osgViewer/ViewerEventHandlers.cpp	(revision 15027)
+++ src/osgViewer/ViewerEventHandlers.cpp	(working copy)
 <at>  <at>  -721,8 +721,8  <at>  <at> 
     if (!view) return false;
     if (_fullscreen)
     {
-        x = ea.getX();
-        y = ea.getY();
+        x = (int) ea.getX();
+        y = (int) ea.getY();
         return true;
     }

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Alexpux | 29 Jul 10:04 2015
Picon

OSG-3.4.0rc7 mingw-w64 gcc-5.x fix

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSG_OPENGL
#define OSG_OPENGL 1

#include <osg/Config>
#include <osg/Export>

#cmakedefine OSG_GL1_AVAILABLE
#cmakedefine OSG_GL2_AVAILABLE
#cmakedefine OSG_GL3_AVAILABLE
#cmakedefine OSG_GLES1_AVAILABLE
#cmakedefine OSG_GLES2_AVAILABLE
#cmakedefine OSG_GLES3_AVAILABLE
#cmakedefine OSG_GL_LIBRARY_STATIC
#cmakedefine OSG_GL_DISPLAYLISTS_AVAILABLE
#cmakedefine OSG_GL_MATRICES_AVAILABLE
#cmakedefine OSG_GL_VERTEX_FUNCS_AVAILABLE
#cmakedefine OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
#cmakedefine OSG_GL_FIXED_FUNCTION_AVAILABLE
#cmakedefine GL_HEADER_HAS_GLINT64
#cmakedefine GL_HEADER_HAS_GLUINT64

#define OSG_GL1_FEATURES  <at> OSG_GL1_FEATURES <at> 
#define OSG_GL2_FEATURES  <at> OSG_GL2_FEATURES <at> 
#define OSG_GL3_FEATURES  <at> OSG_GL3_FEATURES <at> 
#define OSG_GLES1_FEATURES  <at> OSG_GLES1_FEATURES <at> 
#define OSG_GLES2_FEATURES  <at> OSG_GLES2_FEATURES <at> 
#define OSG_GLES3_FEATURES  <at> OSG_GLES3_FEATURES <at> 

#ifndef WIN32

    // Required for compatibility with glext.h sytle function definitions of
    // OpenGL extensions, such as in src/osg/Point.cpp.
    #ifndef APIENTRY
        #define APIENTRY
    #endif

#else // WIN32

    #if defined(__CYGWIN__) || defined(__MINGW32__)

        #ifndef APIENTRY
                #define GLUT_APIENTRY_DEFINED
                #define APIENTRY __stdcall
        #endif
            // XXX This is from Win32's <windef.h>
        #ifndef CALLBACK
            #define CALLBACK __stdcall
        #endif

    #else // ! __CYGWIN__

        // Under Windows avoid including <windows.h>
        // to avoid name space pollution, but Win32's <GL/gl.h>
        // needs APIENTRY and WINGDIAPI defined properly.
        // XXX This is from Win32's <windef.h>
        #ifndef APIENTRY
            #define GLUT_APIENTRY_DEFINED
            #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
                #define WINAPI __stdcall
                #define APIENTRY WINAPI
            #else
                #define APIENTRY
            #endif
        #endif

            // XXX This is from Win32's <windef.h>
        #ifndef CALLBACK
            #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
                #define CALLBACK __stdcall
            #else
                #define CALLBACK
            #endif
        #endif

    #endif // __CYGWIN__

    // XXX This is from Win32's <wingdi.h> and <winnt.h>
    #ifndef WINGDIAPI
        #define GLUT_WINGDIAPI_DEFINED
        #define DECLSPEC_IMPORT __declspec(dllimport)
        #define WINGDIAPI DECLSPEC_IMPORT
    #endif

    // XXX This is from Win32's <ctype.h>
    #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&(__GNUC__ > 2))
        typedef unsigned short wchar_t;
        #define _WCHAR_T_DEFINED
    #endif

#endif // WIN32

#if defined(OSG_GL3_AVAILABLE)
    #define GL3_PROTOTYPES 1
    #define GL_GLEXT_PROTOTYPES 1
#endif

 <at> OPENGL_HEADER1 <at> 
 <at> OPENGL_HEADER2 <at> 

#ifndef GL_APIENTRY
    #define GL_APIENTRY APIENTRY
#endif // GL_APIENTRY

#ifndef GL_HEADER_HAS_GLINT64
    #ifdef _WIN32
        typedef __int64 GLint64;
    #else
        typedef long long int GLint64;
    #endif
#endif

#ifndef GL_HEADER_HAS_GLUINT64
    #ifdef _WIN32
        typedef unsigned __int64 GLuint64;
    #else
        typedef unsigned long long int GLuint64;
    #endif
#endif

#ifdef OSG_GL_MATRICES_AVAILABLE

    inline void glLoadMatrix(const float* mat) { glLoadMatrixf(static_cast<const GLfloat*>(mat)); }
    inline void glMultMatrix(const float* mat) { glMultMatrixf(static_cast<const GLfloat*>(mat)); }

    #ifdef OSG_GLES1_AVAILABLE
        inline void glLoadMatrix(const double* mat)
        {
            GLfloat flt_mat[16];
            for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
            glLoadMatrixf(flt_mat);
        }

        inline void glMultMatrix(const double* mat)
        {
            GLfloat flt_mat[16];
            for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
            glMultMatrixf(flt_mat);
        }

    #else
        inline void glLoadMatrix(const double* mat) { glLoadMatrixd(static_cast<const GLdouble*>(mat)); }
        inline void glMultMatrix(const double* mat) { glMultMatrixd(static_cast<const GLdouble*>(mat)); }
    #endif
#endif

// add defines for OpenGL targets that don't define them, just to ease compatibility across targets
#ifndef GL_DOUBLE
    #define GL_DOUBLE 0x140A
    typedef double GLdouble;
#endif

#ifndef GL_INT
    #define GL_INT 0x1404
#endif

#ifndef GL_UNSIGNED_INT
    #define GL_UNSIGNED_INT 0x1405
#endif

#ifndef GL_NONE
    // OpenGL ES1 doesn't provide GL_NONE
    #define GL_NONE 0x0
#endif

#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
    //GLES defines (OES)
    #define GL_RGB8_OES                                             0x8051
    #define GL_RGBA8_OES                                            0x8058
#endif

#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE)
    #define GL_POLYGON                         0x0009
    #define GL_QUADS                           0x0007
    #define GL_QUAD_STRIP                      0x0008
#endif

#if defined(OSG_GL3_AVAILABLE)
    #define GL_LUMINANCE                      0x1909
    #define GL_LUMINANCE_ALPHA                0x190A
#endif

#endif
Jannik Heller | 28 Jul 23:18 2015
Picon

Check for GL_S3_s3tc

Hi Robert,

Here is a patch for the S3TC capability check.

On a Intel HD graphics Linux system with Mesa 10.1.3, I found that osg's
Extensions::isTextureCompressionS3TCSupported() returned false, even though S3TC compressed
textures *are* in fact working. I tested this by loading and rendering various DXT1, DXT3 and DXT5
compressed textures in the OSG.

"glxinfo | grep s3tc" gives:
    GL_S3_s3tc 

Note, if I install the package "libtxc-dxtn-s2tc0", I get in addition:

glxinfo | grep s3tc
    GL_EXT_texture_compression_s3tc 
    GL_S3_s3tc

However, S3TC compressed textures worked correctly within the OSG even without libtxc-dxtn-s2tc0 installed.

I'm not sure what the differences between these extensions are, but based on the description at
https://www.opengl.org/registry/specs/S3/s3tc.txt I would assume that both will work for OSG's
purposes. The attached patch changes isTextureCompressionS3TCSupported() to accept either
extension. 

Thank you!

Cheers,
Jannik

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

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Terry Welsh | 25 Jul 21:46 2015
Picon

OsgAndroidMacroUtils.cmake not finding Android 3rdparty dependencies

I downloaded the Android 3rdparty deps from here
http://www.openscenegraph.org/index.php/download-section/dependencies
but was not able to use them for a while. Attached are changes to
OsgAndroidMacroUtils.cmake that allow the deps to be found by cmake.

Specifically, all FIND_PATH commands require the
NO_CMAKE_FIND_ROOT_PATH option to actually find paths. This is odd
because if you inspect CMAKE_FIND_ROOT_PATH it appears to be empty. I
would expect it to have no effect at all.

I also needed to remove quotes from this line in order for headers to be found:

set(FREETYPE_INCLUDE_DIRS "${FREETYPE_DIR}/include
${FREETYPE_DIR}/include/freetype/config")

Assuming this script worked in the past, it seems like cmake behavior
may have changed at some point. I'm using cmake version 2.8.12.2.
--
Terry Welsh
http://www.reallyslick.com
Attachment (OsgAndroidMacroUtils.tar.gz): application/x-gzip, 2208 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Gmane