Trajce Nikolov NICK | 21 Jul 20:11 2014
Picon

FBO question

Hi Community,

if I set my camera to RTT into FBO, will the Camera Read/Write buffers points to this FBO?

Thanks a bunch!

Nick

--
trajce nikolov nick
<div><div dir="ltr">Hi Community,<div><br></div>
<div>if I set my camera to RTT into FBO, will the Camera Read/Write buffers points to this FBO?</div>
<div><br></div>
<div>Thanks a bunch!</div>
<div><br></div>
<div>Nick<br clear="all"><div><br></div>-- <br>trajce nikolov nick<br>
</div>
</div></div>
Robert Gosztyla | 21 Jul 18:42 2014
Picon

[osgPlugins] Using plugins inside plugins

Hi

I have written custom plugin to save/load my scene  with custom user data. My solution stores scene tree, but
geodes are stored as paths to separate model files (not geometry data). When scene is loaded, geodes are
created using such piece of code:

Code:
osgDB::ReaderWriter* plyReader = osgDB::Registry::instance()->getReaderWriterForExtension("ply");
osgDB::ReaderWriter::ReadResult result;
osg::Node* node;

if(NULL != plyReader)
result = plyReader->readNode(name.toUtf8().constData());

node = result.takeNode();

Models are loaded, but what is strange, seems that normals are inverted. When i use the same way to load
particular model directly onto scene, models looks fine. Particular format i'm using is "*.ply"
supported by osg plugin. Any idea for such behaviour? Is it safe in general to use plugins in plugin in osg?

Thank you!

Cheers,
Robert

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

Mikhail Matrosov | 21 Jul 15:56 2014
Picon

Why my submission with a bug fix is ignored?

Hi,

I have posted a submission with a bug fix me and several other users have experienced: http://forum.openscenegraph.org/viewtopic.php?t=14029

But there is no response during two weeks for now. Why? Am I doing something wrong?

Best regards, Mikhail

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

Sonya Blade | 20 Jul 18:20 2014
Picon

Dynamically Created LineSegment for Rubber Line

Hi All,

I'm planing to use the osg::LineSegment object as rubber line drawer, that is, arranging in a way that 
when user clicks at any arbitrary locaiton in screen then it will asign the clicked mouse position to 
LineSegment.start()  attribute and when user hoovers the mouse, mouse move position will be assigned 
to LineSegment.end() attribute, if user clicks for the 2nd time then actual line will be drawn and rubber line 
will disappear. 

The problems is: The root node doesn't accept the LineSegment, where compiler complains with following line
"error: no matching function for call to 'osg::Geode::addDrawable(osg::ref_ptr<osg::LineSegment>&)'|"

Googling reveals that LineSegment is used generally for the ray casting in intersector, it seems that it's not 
suitable for that purpose. In order to clarify that can you shed some light on whether the intended task can 
be achieved with LineSegment or not, if not which other way should I use to create rubber line?

Regards, 

<div><div dir="ltr">Hi All,<div><br></div>
<div>I'm planing to use the osg::LineSegment object as rubber line drawer, that is, arranging in a way that&nbsp;</div>
<div>when user clicks at any arbitrary locaiton in screen then it will asign the clicked mouse position to&nbsp;</div>
<div>LineSegment.start() &nbsp;attribute and when user hoovers the mouse, mouse move position will be assigned&nbsp;</div>
<div>to LineSegment.end() attribute, if user clicks for the 2nd time then actual line will be drawn and rubber line&nbsp;</div>
<div>will disappear.&nbsp;</div>
<div><br></div>
<div>The problems is: The root node doesn't accept the LineSegment, where compiler complains with following line</div>
<div>"error: no matching function for call to 'osg::Geode::addDrawable(osg::ref_ptr&lt;osg::LineSegment&gt;&amp;)'|"</div>
<div><br></div>
<div>Googling reveals that LineSegment is used generally for the ray casting in intersector, it seems that it's not&nbsp;</div>
<div>suitable for that purpose. In order to clarify that can you shed some light on whether the intended task can&nbsp;</div>
<div>be achieved with LineSegment or not, if not which other way should I use to create rubber line?</div>
<div><br></div>
<div>Regards,&nbsp;</div>
<div><br></div> 		 	   		  </div></div>
Bram Vaessen | 20 Jul 17:11 2014
Picon

osgText::Text darker when rendered on frame buffer

Hi,

I'm having a small issue with the osgText::Text that I can't figure out.

There is difference in how bright the text looks when I compare a osgText::Text drawn on screen, and the same
one, but then drawn on a framebuffer, and then (the buffer) drawn on screen. Should be exactly the same
right, if the bg color is the same?

I attached a small part of a screenshot to show the difference. Other things that I draw on the framebuffer do
not appear darker, so it seems to be related to osgText::Text.

Here are some parts of the code:

camera for gui on screen:

Code:
osg::ref_ptr<osg::Camera> camera = new osg::Camera();
	camera->setViewport(new osg::Viewport(0,0,width,height));
	camera->setClearMask(GL_DEPTH_BUFFER_BIT);
	camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
	camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
	camera->setRenderOrder(osg::Camera::POST_RENDER,0);
	camera->setProjectionMatrixAsOrtho2D(0,width,height,0);
	//camera->setViewMatrix(camera->getViewMatrix() * osg::Matrixd::scale(1,-1.f,1));
	camera->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON); //blend
	camera->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
	camera->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::OFF);
	camera->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED);
	camera->getOrCreateStateSet()->setMode(GL_FOG, osg::StateAttribute::OFF);

camera for rendering to a framebuffer:

Code:
osg::ref_ptr<osg::Camera> camera = new osg::Camera();
	camera->setViewport(new osg::Viewport(0,0,width,height));
	camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
	camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
	camera->setClearColor(osg::Vec4(0,0,0,0));
	camera->setRenderOrder(osg::Camera::PRE_RENDER,0);
	camera->setProjectionMatrixAsOrtho2D(0,width,height,0);
	camera->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON); //blend
	camera->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
	camera->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
	camera->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::OFF);
	camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
	camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0), texture);

texture used for framebuffer:

	
Code:
osg::ref_ptr<osg::TextureRectangle> rect = new osg::TextureRectangle;
    rect->setTextureSize(width, height);
    rect->setInternalFormat(GL_RGBA32F_ARB);
	rect->setSourceFormat(GL_RGBA);
	rect->setSourceType(GL_FLOAT);
	rect->setFilter(osg::TextureRectangle::MIN_FILTER,osg::TextureRectangle::NEAREST);
    rect->setFilter(osg::TextureRectangle::MAG_FILTER,osg::TextureRectangle::NEAREST);

quad used to render the framebuffer onscreen:

Code:
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
	geode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
	osg::ref_ptr<osg::Geometry> geom = new osg::Geometry();
	geom->setSupportsDisplayList(false);
	osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
	osg::ref_ptr<osg::Vec2Array> texcoords = new osg::Vec2Array;
	vertices->push_back(osg::Vec3d(0,0,0)); texcoords->push_back(osg::Vec2(0,height));
	vertices->push_back(osg::Vec3d(0,height,0)); texcoords->push_back(osg::Vec2(0,0));
	vertices->push_back(osg::Vec3d(width,height,0)); texcoords->push_back(osg::Vec2(width,0));
	vertices->push_back(osg::Vec3d(width,0,0)); texcoords->push_back(osg::Vec2(width,height));
	osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
	colors->push_back(color);
	geom->setVertexArray(vertices);
	geom->setTexCoordArray(0,texcoords);
	geom->setColorArray(colors);
	geom->setColorBinding(osg::Geometry::BIND_OVERALL);
	geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,vertices->size()));
	geode->addDrawable(geom);

Does anyone have an idea what could cause this? I've looked at the source of osgText::Text, but it seems very
complicated, and it also uses a custom rendering so it doesn't seem to be affected much by the render states
(for example I don't think you can turn blending off trough the stateset when rendering text?), so I have no
clue at this point...

Thank you!

Cheers,
Bram
Code:

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

Attachments: 
http://forum.openscenegraph.org//files/textproblem_940.png

Björn Blissing | 20 Jul 13:17 2014
Picon

Ambiguous defines in Atomic.cpp when compiling with MinGW and GCC

Hi Robert et al,

I tried to compile OSG with QT Creator using MinGW and GCC 4.8.2.

It worked pretty well. But I found a case of ambiguous defines in Atomic.cpp in OpenThreads.

The problem is that both:
_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS 
and
_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED

is defined. This gives the following problems.

1. Since _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED is defined we will enter the section:

Code:
#if defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
#include <windows.h>
#include <intrin.h>
#pragma intrinsic(_InterlockedAnd)
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedXor)
#endif

Which will result in warnings since intrinsic in an unknown pragma for GCC. But since _InterlockedAnd,
_InterlockedOr and _InterlockedXor ARE defined inside intrin.h on MinGW it will work. So the pragma
lines should only be run if we are using MSVC.

2. But in the atomic operators we will not be able to use the previously defined intrinsics, due to the fact
that _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS is defined. The compiler will never reach the code inside _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED.
Example:

Code:
unsigned
Atomic::operator++()
{
#if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
    return __sync_add_and_fetch(&_value, 1);
#elif defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
    return InterlockedIncrement(&_value);
#elif defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
    return OSAtomicIncrement32(&_value);
#else
# error This implementation should happen inline in the include file
#endif
}

I do not know if there are any benefits of using one or the other. But I do not think we should define both.

Best regards,
Björn

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

_______________________________________________
osg-users mailing list
osg-users <at> lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Shyguy | 20 Jul 05:49 2014

How to start osgViewer with light On?

Hi..I am new to programming osg...

When my scene shows, it is very dark.

Then I click the "L"key scene shows bright.

So My Question is "How to start the viewer with L key pressed?"

Someone Help me....pz.....

Thanks....
 
 
 
 
 
 
 
 
 
당신과 제가 다름이 세상을 풍요롭게 합니다...^^v
Differences between U and me make the world plentiful...^^v
<div><div class="wc_wrapper">
<div>Hi..I am new to programming osg...</div>
<div><br></div>
<div>When my scene shows,&nbsp;it is very dark.</div>
<div><br></div>
<div>Then I click the "L"key scene shows bright.</div>
<div><br></div>
<div>So My Question is "How to start the viewer with L key pressed?"</div>
<div><br></div>
<div>Someone Help me....pz.....</div>
<div><br></div>
<div>Thanks....</div>
<div class="_wcSign"><div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&#45817;&#49888;&#44284; &#51228;&#44032; &#45796;&#47492;&#51060; &#49464;&#49345;&#51012; &#54413;&#50836;&#47213;&#44172; &#54633;&#45768;&#45796;...^^v</div>
<div>Differences between U and me make the world plentiful...^^v</div>
</div></div>
</div></div>
Bram Vaessen | 20 Jul 02:49 2014
Picon

Re: osgText::Text and screen

I had the exact same issue, but I tried to flip the view matrix as suggested, but I must be doing something
wrong, because I don't see anything when I try this:

Code:
camera->setViewMatrix(camera->getViewMatrix() * osg::Matrixd::scale(1,-1.f,1));

Can anyone tell me the right way to flip the view matrix on the y? thanks!

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

Sonya Blade | 19 Jul 13:12 2014
Picon

Flickering in CompositeViewer with Scribe Effect

Hi All,

I'm experiencing a flickering with composite-viewer example taken in original OSG web-site.
The problem is, when the cow is picked there is slight flickering in the model, after taking 
the deliberate look at the scene I also noticed that damaged cessna is not flickering at all 
with same PickHandle, I 'm not so sure whether it is an eye-illusion or not, but I'd be better 
if I know how to avoid it.

Regards,
<div><div dir="ltr">Hi All,<div><br></div>
<div>I'm experiencing a flickering with composite-viewer example taken in original OSG web-site.</div>
<div>The problem is, when the cow is picked there is slight flickering in the model, after taking&nbsp;</div>
<div>the deliberate look at the scene I also noticed that damaged cessna is not flickering at all&nbsp;</div>
<div>with same PickHandle, I 'm not so sure whether it is an eye-illusion or not, but I'd be better&nbsp;</div>
<div>if I know how to avoid it.</div>
<div><br></div>
<div>Regards,</div> 		 	   		  </div></div>
Sonya Blade | 19 Jul 10:16 2014
Picon

Disabling cameramanipulator in CompositeViewer

Dear All,
I need to switch off the camera manipulator in one of the views in composite viewer.  
Setting the view->setCameraManipulator(NULL); doesn't work in my case, setting camera 
manipulator to the 0 value doesn't help also. 

Furthermore, having calling the view->getCamera()->setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);
in each scrolling doesn't cause any wreak havoc or any performance penalty, right?

case ( osgGA::GUIEventAdapter::MOVE):
                {
                    newx = ea.getX(); newy = ea.getY();
                    break;
                }
            case (osgGA::GUIEventAdapter::SCROLL):
                {
                    osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();
                    switch (sm)
                    {
                    case osgGA::GUIEventAdapter::SCROLL_UP :
                        {
                            newx -=5; newy -=5;
                            view->getCamera()->setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);
                            break;

                        }
                    case(osgGA::GUIEventAdapter::SCROLL_DOWN):
                        {
                            newx += 5; newy +=5;
                            view->getCamera()->setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);
                            break;
                        }
                    }
                   // view->getCamera()->setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);
                }
<div><div dir="ltr">
<div>Dear All,</div>
<div>I need to switch off the camera manipulator in one of the views in composite viewer. &nbsp;</div>
<div>Setting the&nbsp;view-&gt;setCameraManipulator(NULL); doesn't work in my case, setting camera&nbsp;</div>
<div>manipulator to the 0 value doesn't help also.&nbsp;</div>
<div><br></div>
<div>Furthermore, having calling the&nbsp;<span>view-&gt;getCamera()-&gt;setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);</span>
</div>
<div><span>in each scrolling doesn't cause any wreak havoc or any performance penalty, right?</span></div>
<div><br></div>
<div>case ( osgGA::GUIEventAdapter::MOVE):</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newx = ea.getX(); newy = ea.getY();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case (osgGA::GUIEventAdapter::SCROLL):</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (sm)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case osgGA::GUIEventAdapter::SCROLL_UP :</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newx -=5; newy -=5;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view-&gt;getCamera()-&gt;setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</div>
<div><br></div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case(osgGA::GUIEventAdapter::SCROLL_DOWN):</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newx += 5; newy +=5;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view-&gt;getCamera()-&gt;setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// view-&gt;getCamera()-&gt;setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div> 		 	   		  </div></div>
Yu Zhang | 18 Jul 18:33 2014

osgViewer::setSceneData calling sequence with osgUtil::Tessellator

Hi experts,

I have 2 piece of code, use tessellaor to extrude and hole generation. Looks the setSceneData should call
after hole tessellation operation, otherwise the viewer will draw nothing. Could you please advice on
how 
to setSceneData the root nodes in the begin of application, and update 
the tessellated geometries in the runtime? 

Code piece A runs fine.:

_viewer.setSceneData( canvas ); //canvas is a osg::Group, root node

 osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
    vertices->push_back(osg::Vec3(1.0, 1.0, 0.0));
    vertices->push_back(osg::Vec3(-1.0, 1.0, 0.0));
    vertices->push_back(osg::Vec3(-1.0, -1.0, 0.0));
    vertices->push_back(osg::Vec3(1.0, -1.0, 0.0));

    osg::ref_ptr<osg::Vec3Array> newVertices = new osg::Vec3Array;
    newVertices->insert( newVertices->begin(), vertices->begin(), vertices->end() );

    unsigned int numVertices = vertices->size();
    osg::Vec3 offset = osg::Vec3(0.0, 0.0, 1.0) * 1.0;
    for ( osg::Vec3Array::reverse_iterator ritr=vertices->rbegin();
          ritr!=vertices->rend(); ++ritr )
    {
        newVertices->push_back( (*ritr) + offset );
    }

    osg::ref_ptr<osg::Geometry> extrusion = new osg::Geometry;
    extrusion->setVertexArray( newVertices.get() );
    extrusion->addPrimitiveSet( new osg::DrawArrays(GL_POLYGON, 0, numVertices) );
    extrusion->addPrimitiveSet( new osg::DrawArrays(GL_POLYGON, numVertices, numVertices) );

    osgUtil::Tessellator tessellator;
    tessellator.setTessellationType( osgUtil::Tessellator::TESS_TYPE_GEOMETRY );
    tessellator.setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD );
    tessellator.retessellatePolygons( *extrusion );

    osg::ref_ptr<osg::DrawElementsUInt> sideIndices = new osg::DrawElementsUInt( GL_QUAD_STRIP );
    for ( unsigned int i=0; i<numVertices; ++i )
    {
        sideIndices->push_back( i );
        sideIndices->push_back( (numVertices-1-i) + numVertices );
    }
    sideIndices->push_back( 0 );
    sideIndices->push_back( numVertices*2 - 1 );
    extrusion->addPrimitiveSet( sideIndices.get() );

    osg::Geode* geode = new osg::Geode;
    geode->addDrawable(extrusion);
    canvas->addChild(geode);

Code piece B: runs without any geometry showed, if I put the first setSceneData to the last line, it works.

       _viewer.setSceneData( canvas );

        int nstart=0; // counts vertices used for the geometry primitives

        osg::ref_ptr<osg::Geometry> gtess= new osg::Geometry;
        int i;
        osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
        double zpos = 0.0;
        // front wall
        static GLdouble wall[5][2] =
        { { 2200.0, 1130.0 },
          { 2600.0, 1130.0 },
          { 2600.0, 1340.0 },
          { 2400.0, 1440.0 },
          { 2200.0, 1340.0 } };

        static GLdouble windows[16][2] =
        { { 2240.0, 1180.0 },
          { 2330.0, 1180.0 },
          { 2330.0, 1220.0 },
          { 2240.0, 1220.0 } };

        gtess->setVertexArray(coords);

        // add one large pentagon -the wall
        for (i = 0; i < 5; i++) {
            coords->push_back(osg::Vec3(wall[i][0],zpos,wall[i][1]));
        }

        osg::ref_ptr<osg::DrawArrays> contour1 = new osg::DrawArrays(osg::PrimitiveSet::POLYGON,nstart,5);
        gtess->addPrimitiveSet(contour1);nstart+=5;

        // and windows
        for (i = 0; i < 4; i++) {
            coords->push_back(osg::Vec3(windows[i][0],zpos,windows[i][1]));
        }

        osg::ref_ptr<osg::DrawArrays> contour2 = new osg::DrawArrays(osg::PrimitiveSet::QUADS,nstart,4);
        gtess->addPrimitiveSet(contour2);nstart+=4;

   osgUtil::Tessellator tscx; // the v1.2 multi-contour Tessellator.
             tscx.setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
    tscx.setBoundaryOnly(false);
    tscx.setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD); 

    tscx.retessellatePolygons(*gtess);

    osg::Geode* geode = new osg::Geode;
    geode->addDrawable(gtess);
    canvas->addChild(geode);

OSG 3.2.0 OS X 10.9.4, with Qt 4.8.6 with osgQt

Thank you!

Cheers,
Yu

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


Gmane