[osg-users] Problem using OclusionQueryNode (geometry bliking!)

2013-05-07 Thread Pablo Carneiro Elias
Hi all,

I have been trying to use OcclusionQueryNode for a while now with no success. 
After searching about the gometry bliking problem, I have found one post 
noticing this problem and proposing a fix. Since it was almost two years ago, I 
though the solution was already merged in master branch of git, but after 
updating to latest version, the problem remains. 

I tried to used the proposed fix which was to overwrite the virtual 
OcclusionQueyrNode's virtual method getPassed ( const ::osg::Camera* camera, 
::osg::NodeVisitor nv ) and add some extra checks about LOD...

Nothing seems to work and my geometry is bliking. I have a complex IVE model 
with many sub objets and no LOD, but all sub geodes seem to bliking all the 
time.. it only stops some times when I get very close to some geometry


I have tried also increasing visibility threshold and query frame count.. 
nothing works!

The occlusionquery example of osg works beause it seems to create a single 
giant geometry. In my case I have a model create in 3D max exported to IVE 
which conaints a lot of sub objects

Any one can help?! Thanks in advance!

Pablo

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Extrude Geometry

2013-05-07 Thread Braden Edmunds
I've roughly followed the osgmanipulator.cpp example to create 
osgManipulator::Translate1DDragger objects and link them to my custom geometry 
items and everything works fine. I'm encountering a problem when I try to 
update a geometry item inside of the traverse method. The following code is 
where it breaks:


Code:

void DraggerContainer::traverse(osg::NodeVisitor nv)
{
 //setup


//
osg::Vec3 trans = _dragger-getMatrix().getTrans();

_dragger-setMatrix( osg::Matrix::rotate(osg::inDegrees(degrees),rotationAxis) 
* osg::Matrix::scale(scaleFactor) 
* osg::Matrix::translate(trans)); //re-position the draggable item

if(prev_trans.length() != trans.length())
{
UpdateGeometry(trans); // --- Breaks after this returns

}

osg::Group::traverse(nv);
}




The error is vector iterator not incrementable  vector line 99, but this 
error is only produced after running through functions in viewer.dll and 
osg.dll. 

I'm wondering if this is the correct way to extrude geometry on the fly, and if 
adding nodes during the traverse call will cause an iterator to become invalid.

Thanks in advance,

Braden


[/code]

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG Build with Visual Studio 2010

2013-05-07 Thread Braden Edmunds
Hi Sujan,

Hopefully these steps can will help you build in both release and debug mode:

1. Download the osg source
2. Run Cmake (setup all paths: 3rd_party libs, Qt directory, etc)
a. Make sure you select the Visual Studio 10 compiler
b. Click Generate
3. Locate the solution file (.sln) cmake generated for you and open it
4. Build in both debug and release mode inside of Visual Studio (this will 
produce both osgQtd.dll and osgQt.dll and their corresponding .lib files.

I hope that helps.

Braden

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG Build with Visual Studio 2010

2013-05-07 Thread Sujan Dasmahapatra
Thanks Braden.


On Wed, May 8, 2013 at 3:26 AM, Braden Edmunds edmu...@reaction-eng.comwrote:

 Hi Sujan,

 Hopefully these steps can will help you build in both release and debug
 mode:

 1. Download the osg source
 2. Run Cmake (setup all paths: 3rd_party libs, Qt directory, etc)
 a. Make sure you select the Visual Studio 10 compiler
 b. Click Generate
 3. Locate the solution file (.sln) cmake generated for you and open it
 4. Build in both debug and release mode inside of Visual Studio (this will
 produce both osgQtd.dll and osgQt.dll and their corresponding .lib files.

 I hope that helps.

 Braden

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





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Thanks  Regards
Sujan
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem using OclusionQueryNode (geometry bliking!)

2013-05-07 Thread Pablo Carneiro Elias
Hi All, I am sorry for the post, I found out the problem... our rendering 
system splits de Z for rendering distant objects nicely. Z splitting is done by 
rendering most distant partitions first... well, it is exactly the oposite 
needed for occlusion query... its absolute incompatible. I know osg has z 
splitting support but we cant use it because we generate our own matrices using 
other closed subsystem... So we grab our projection and view matrices and set 
into osg system (cameras) one split at time... 


Anyway, I will have to come up with something intelligent such as rendering one 
time using single geometries and a giant frustum (no split) and saving the 
OQNode state for the split phase...

The thing is each time we render a Z partition we call frame() in order to 
render.. but that increments framecount and OQnode uses frame counting.. so OQN 
may occlude some objects in 1 partition an not in other partition... If we 
could just render N splits as 1 frame, it may help (controlling when to 
start/end frame)... Not sure..

Thanks

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] MousepressEvent not able to capture from osg::Viewer by Qt

2013-05-07 Thread Sujan Dasmahapatra
I am trying to implement a mouse press event with QT and OSG but unable to
do it. Pls help.

Below is my ViewerWidget class which is derived from QWidget and
osg::CompositeViewer..In the constructor I got gView which is a
osg::GLWidget, I am trying override mousePressEvent but when I click
message not coming. What I am doing wrong pls help..

My gView pointer is of class CSGraphicsView as below
/
#ifndef GVIEW_H
#define GVIEW_H
#include osg\GraphicsContext
#include osgQt\GraphicsWindowQt
#include QtGui\qwidget.h
#include QtCore\qobject.h
#include QtGui\qmouseeventtransition.h
class CSGraphicsView : public osgQt::GLWidget
{
public:
CSGraphicsView(QWidget* parent=0);
~CSGraphicsView();

virtual void mousePressEvent(QMouseEvent *e);
};

#endif // GVIEW_H


//Implementations is
void CSGraphicsView::mousePressEvent(QMouseEvent *e)
{
QMessageBox msg;
msg.setText(Mouse pressed);
msg.exec();
}//But this msg is not coming when i am pressing mouse.
/

/
ViewerWidget::ViewerWidget(osgViewer::ViewerBase::ThreadingModel
threadingModel, osg::Group* scene) : QWidget()
{
setThreadingModel(threadingModel);

gView = static_castCSGraphicsView* (addViewWidget(
createCamera(0,0,100,100), scene ));

QGridLayout* grid = new QGridLayout;
grid-addWidget( gView, 0, 0 );
setLayout( grid );

connect( _timer, SIGNAL(timeout()), this, SLOT(update()) );
_timer.start( 10 );
}

osgQt::GLWidget* ViewerWidget::addViewWidget( osg::Camera* camera,
osg::Group* scene )
{
osgViewer::View* view = new osgViewer::View;
view-setCamera( camera );
addView( view );

view-setSceneData( scene );
view-addEventHandler( new osgViewer::StatsHandler );
view-setCameraManipulator( new osgGA::TrackballManipulator );

gw = dynamic_castosgQt::GraphicsWindowQt* (
camera-getGraphicsContext() );
return gw ? gw-getGLWidget() : NULL;
}


osg::Camera* ViewerWidget::createCamera( int x, int y, int w, int h, const
std::string name, bool windowDecoration )
{
osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
osg::ref_ptrosg::GraphicsContext::Traits traits = new
osg::GraphicsContext::Traits;
traits-windowName = name;
traits-windowDecoration = windowDecoration;
traits-x = x;
traits-y = y;
traits-width = w;
traits-height = h;
traits-doubleBuffer = true;
traits-alpha = ds-getMinimumNumAlphaBits();
traits-stencil = ds-getMinimumNumStencilBits();
traits-sampleBuffers = ds-getMultiSamples();
traits-samples = ds-getNumMultiSamples();

osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setGraphicsContext( new
osgQt::GraphicsWindowQt(traits.get()) );

camera-setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) );
camera-setViewport( new osg::Viewport(0, 0, traits-width,
traits-height) );
camera-setProjectionMatrixAsPerspective(
30.0f,
static_castdouble(traits-width)/static_castdouble(traits-height),
1.0f, 1.0f );
return camera.release();
 }



void ViewerWidget::paintEvent( QPaintEvent* event )
{
frame();
}
/
-- 
Thanks  Regards
Sujan
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org