[osg-users] Background image...

2009-12-19 Thread alessandro terenzi
I'd like to create a fixed background for an osg application, much like a
HUD but while the HUD is always on top of the scene, I need to have an image
always behind any 3D object.

I tried to modify the example about HUDs by changing:

setRenderOrder(osg::Camera::POST_RENDER);

into this:

setRenderOrder(osg::Camera::PRE_RENDER);

but I guess that this is not sufficent to achive my goal, because actually
the background image is not displayed at all (or maybe it is covered by the
scene...).

How can I create the desired effect?
Thanks in advance.
Alessandro
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OSG lightning

2009-12-19 Thread Dominic Stalder

Hi there

is there an OSG package for rendering lightning (I mean flashes not 
lighting)? Or does someone have some good examples?


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


Re: [osg-users] Background image...

2009-12-19 Thread Trajce Nikolov
Hi Alessandro,

nah. That wont do the job. I did a quick test, and here is how I made it
work

go the the osgHUD example and:

1. createHUD, set for the camera:
camera-setRenderOrder(osg::Camera::NESTED_RENDER);

2. in main, about line 362, where you load your scene without arguments
osg::ref_ptrosg::Group group  = new osg::Group;
osg::Node* one = createHUD(); // this will be your background image
osg::Node* two = scene.get();
one-getOrCreateStateSet()-setRenderBinDetails(1,RenderBin);
two-getOrCreateStateSet()-setRenderBinDetails(2,RenderBin);
group-addChild(one);
group-addChild(two);
group-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
two-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);

// add the HUD subgraph.
//if (scene.valid()) group-addChild(scene.get());
//group-addChild(createHUD());

// set the scene to render
viewer.setSceneData(group.get());


this is working code. Might be another way, but this will help you I think

Let me know if it works for you

Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey

On Sat, Dec 19, 2009 at 11:16 AM, alessandro terenzi a.tere...@gmail.comwrote:

 I'd like to create a fixed background for an osg application, much like a
 HUD but while the HUD is always on top of the scene, I need to have an image
 always behind any 3D object.

 I tried to modify the example about HUDs by changing:

 setRenderOrder(osg::Camera::POST_RENDER);

 into this:

 setRenderOrder(osg::Camera::PRE_RENDER);

 but I guess that this is not sufficent to achive my goal, because actually
 the background image is not displayed at all (or maybe it is covered by the
 scene...).

 How can I create the desired effect?
 Thanks in advance.
 Alessandro

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


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


[osg-users] [Newbie]: Can`t update Ortho2D camera after resize

2009-12-19 Thread Karl Karsten
Hello,

I am  trying to find the right way to update my 2D camera after a window
resize. I check all the mailing list but I can't find the trick.
Maybe somebody can help.
I try the followings

1. Setting up the camera:
...
camera2d = new osg::Camera;
camera2d-setReferenceFrame(osg::Transform::ABSOLUTE_RF);

osgViewer::Viewer::Windows windows;
viewerWindow-getWindows(windows);
if (windows.empty())
return;
camera2d-setGraphicsContext(windows[0]);

camera2d-setProjectionMatrixAsOrtho2D(0, viewerWindow-width(), 0,
viewerWindow-height());
camera2d-setViewport(new
osg::Viewport(*(viewerWindow-getCamera()-getViewport(;
...

2. The resizeGL method from my Qt OSG adapter class

void QtOsgWidget::resizeGL(int width, int height)
{
_gw-getEventQueue()-windowResize(0, 0, width, height);
_gw-resized(0, 0, width, height);
// Seems not working
_gw-resizedImplementation(0, 0, width, height);

// a manual update will work, but I think this
// is not the elegant way to do it

osg::GraphicsContext::Cameras cameras = _gw-getCameras();
osg::Camera * camera = cameras.back(); // My Ortho2D Camera

// This will work!
camera-setProjectionMatrixAsOrtho2D(0, width, 0, height);
}

Many thanks for a tip.

Karl ...


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


Re: [osg-users] Background image...

2009-12-19 Thread alessandro terenzi
Thank you very much Nick, it worked fine, I just changed this:

group
-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

into this:

one-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

Regards.
Alessandro

On Sat, Dec 19, 2009 at 12:42 PM, Trajce Nikolov
nikolov.tra...@gmail.comwrote:

 Hi Alessandro,

 nah. That wont do the job. I did a quick test, and here is how I made it
 work

 go the the osgHUD example and:

 1. createHUD, set for the camera:
 camera-setRenderOrder(osg::Camera::NESTED_RENDER);

 2. in main, about line 362, where you load your scene without arguments
 osg::ref_ptrosg::Group group  = new osg::Group;
 osg::Node* one = createHUD(); // this will be your background image
 osg::Node* two = scene.get();
 one-getOrCreateStateSet()-setRenderBinDetails(1,RenderBin);
 two-getOrCreateStateSet()-setRenderBinDetails(2,RenderBin);
 group-addChild(one);
 group-addChild(two);

 group-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
 two-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);

 // add the HUD subgraph.
 //if (scene.valid()) group-addChild(scene.get());
 //group-addChild(createHUD());

 // set the scene to render
 viewer.setSceneData(group.get());


 this is working code. Might be another way, but this will help you I think

 Let me know if it works for you

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Ünalan, İstanbul, Turkey

 On Sat, Dec 19, 2009 at 11:16 AM, alessandro terenzi 
 a.tere...@gmail.comwrote:

 I'd like to create a fixed background for an osg application, much like a
 HUD but while the HUD is always on top of the scene, I need to have an image
 always behind any 3D object.

 I tried to modify the example about HUDs by changing:

 setRenderOrder(osg::Camera::POST_RENDER);

 into this:

 setRenderOrder(osg::Camera::PRE_RENDER);

 but I guess that this is not sufficent to achive my goal, because actually
 the background image is not displayed at all (or maybe it is covered by the
 scene...).

 How can I create the desired effect?
 Thanks in advance.
 Alessandro

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



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


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


Re: [osg-users] Background image...

2009-12-19 Thread Trajce Nikolov
u r welcome .. Glad it works

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Sat, Dec 19, 2009 at 2:49 PM, alessandro terenzi a.tere...@gmail.comwrote:

 Thank you very much Nick, it worked fine, I just changed this:


 group
 -getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

 into this:

 one
 -getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

 Regards.
 Alessandro


 On Sat, Dec 19, 2009 at 12:42 PM, Trajce Nikolov nikolov.tra...@gmail.com
  wrote:

 Hi Alessandro,

 nah. That wont do the job. I did a quick test, and here is how I made it
 work

 go the the osgHUD example and:

 1. createHUD, set for the camera:
 camera-setRenderOrder(osg::Camera::NESTED_RENDER);

 2. in main, about line 362, where you load your scene without arguments
 osg::ref_ptrosg::Group group  = new osg::Group;
 osg::Node* one = createHUD(); // this will be your background image
 osg::Node* two = scene.get();
 one-getOrCreateStateSet()-setRenderBinDetails(1,RenderBin);
 two-getOrCreateStateSet()-setRenderBinDetails(2,RenderBin);
 group-addChild(one);
 group-addChild(two);

 group-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

 two-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);

 // add the HUD subgraph.
 //if (scene.valid()) group-addChild(scene.get());
 //group-addChild(createHUD());

 // set the scene to render
 viewer.setSceneData(group.get());


 this is working code. Might be another way, but this will help you I think

 Let me know if it works for you

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Ünalan, İstanbul, Turkey

 On Sat, Dec 19, 2009 at 11:16 AM, alessandro terenzi a.tere...@gmail.com
  wrote:

 I'd like to create a fixed background for an osg application, much like a
 HUD but while the HUD is always on top of the scene, I need to have an image
 always behind any 3D object.

 I tried to modify the example about HUDs by changing:

 setRenderOrder(osg::Camera::POST_RENDER);

 into this:

 setRenderOrder(osg::Camera::PRE_RENDER);

 but I guess that this is not sufficent to achive my goal, because
 actually the background image is not displayed at all (or maybe it is
 covered by the scene...).

 How can I create the desired effect?
 Thanks in advance.
 Alessandro

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



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



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


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


Re: [osg-users] Background image...

2009-12-19 Thread Trajce Nikolov
There is DepthSortedBin as well

osg::ref_ptrosg::Group group  = new osg::Group;
osg::Node* one = createHUD(); // this will be your background image
 osg::Node* two = scene.get();
one-getOrCreateStateSet()-setRenderBinDetails(1,DepthSortedBin);
 two-getOrCreateStateSet()-setRenderBinDetails(2,DepthSortedBin);
group-addChild(one);
 group-addChild(two);
one-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Sat, Dec 19, 2009 at 2:49 PM, alessandro terenzi a.tere...@gmail.comwrote:

 Thank you very much Nick, it worked fine, I just changed this:


 group
 -getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

 into this:

 one
 -getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

 Regards.
 Alessandro


 On Sat, Dec 19, 2009 at 12:42 PM, Trajce Nikolov nikolov.tra...@gmail.com
  wrote:

 Hi Alessandro,

 nah. That wont do the job. I did a quick test, and here is how I made it
 work

 go the the osgHUD example and:

 1. createHUD, set for the camera:
 camera-setRenderOrder(osg::Camera::NESTED_RENDER);

 2. in main, about line 362, where you load your scene without arguments
 osg::ref_ptrosg::Group group  = new osg::Group;
 osg::Node* one = createHUD(); // this will be your background image
 osg::Node* two = scene.get();
 one-getOrCreateStateSet()-setRenderBinDetails(1,RenderBin);
 two-getOrCreateStateSet()-setRenderBinDetails(2,RenderBin);
 group-addChild(one);
 group-addChild(two);

 group-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

 two-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);

 // add the HUD subgraph.
 //if (scene.valid()) group-addChild(scene.get());
 //group-addChild(createHUD());

 // set the scene to render
 viewer.setSceneData(group.get());


 this is working code. Might be another way, but this will help you I think

 Let me know if it works for you

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Ünalan, İstanbul, Turkey

 On Sat, Dec 19, 2009 at 11:16 AM, alessandro terenzi a.tere...@gmail.com
  wrote:

 I'd like to create a fixed background for an osg application, much like a
 HUD but while the HUD is always on top of the scene, I need to have an image
 always behind any 3D object.

 I tried to modify the example about HUDs by changing:

 setRenderOrder(osg::Camera::POST_RENDER);

 into this:

 setRenderOrder(osg::Camera::PRE_RENDER);

 but I guess that this is not sufficent to achive my goal, because
 actually the background image is not displayed at all (or maybe it is
 covered by the scene...).

 How can I create the desired effect?
 Thanks in advance.
 Alessandro

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



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



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


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


Re: [osg-users] What are the your favorite free 3d model sites?

2009-12-19 Thread Maxim Gammer
+ free 3dmax models .
http://cde.tsogu.ru/3d_scenes/
http://cde.tsogu.ru/lybrery/
http://cde.tsogu.ru/3d_vneshnee/
http://cde.tsogu.ru/3D_upravlenie/
http://cde.tsogu.ru/3d_mebel/
http://cde.tsogu.ru/3d_equipment/
http://cde.tsogu.ru/3d_indicator/
http://cde.tsogu.ru/3d_dezign/



2009/12/19 Jim Brooks jimbl...@gmail.com

 I'm planning to put together a test app and would like to be able to
 add some new content to OpenSceneGraph-Data such as a vehicle and
 house(s).

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




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


[osg-users] how to disable FBO extension

2009-12-19 Thread Csaba Halász
I'd like to disable the usage of the FBO extension at runtime. I tried
setting the OSG_GL_EXTENSION_DISABLE env var, but it didn't work.
Looking into FrameBufferObject.cpp, it seems that it is directly
loading the required functions via setGLExtensionFuncPtr and only
consults the isGLExtensionSupported for the
GL_EXT_packed_depth_stencil. Am I reading this right, is it
intentional, and how do I disable the FBO extension then?

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


Re: [osg-users] Benchmarking Software (Linux)

2009-12-19 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2009-12-18 21:53, Jeremy Moles wrote:
 Is anyone aware of any nice OpenGL benchmarking software for Linux? Do I
 need to write something like this? (LIKE I HAVE THE TIME!) :)
 

No need, check the Phoronix test suite. They have a set of standard
tests they use to review graphic cards in Linux.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLLQVYn11XseNj94gRAtSXAJ96TE9xp/7+kI1b67ijMztXXwZqFgCePv5E
sezBbpFcixi5HRfwlGaq4cU=
=ma1p
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] QOSGWidget display problem

2009-12-19 Thread Cedric Pinson
I tried this fix and it works fine now.

Thank you for the fix

Cheers,
Cedric

-- 
Provide OpenGL services around OpenSceneGraph and more
+33 659 598 614 Cedric Pinson mailto:cedric.pin...@plopbyte.net
http://www.plopbyte.net


On Sat, 2009-12-19 at 05:58 +, Martin Beckett wrote:
 I remember Don's point about the background paint attribute being different 
 on windows Qt but i could never get a reliable fix.
 
 The dummy QPaintEngine function has fixed the flicker problem for me on 
 Windows (XP, Qt4.6.0, Osg 2.9.6). 
 
 What further testing do we need for it to be an accepted fix?
 
 Cheers,
 Martin
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=21688#21688
 
 
 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 


signature.asc
Description: This is a digitally signed message part
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] getCamera matrix in update callback

2009-12-19 Thread Trajce Nikolov
Hi,

with the following setup I expect to have a line from the center of the
screeen to the point hard coded. It not that case. Any ideas?

Thanks

this is geode update callback


class UpdateCallback : public osg::NodeCallback
{
public:
UpdateCallback(osgViewer::Viewer* viewer)
 : mViewer(viewer)
{
}

virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
 osg::Geode* geode = dynamic_castosg::Geode*(node);
if (!geode) return;

geode-removeDrawables(0,geode-getNumDrawables());

osg::Geometry* geometry = new osg::Geometry;
 geode-addDrawable(geometry);

osg::Vec3 eye;
osg::Vec3 center;
 osg::Vec3 up;
mViewer-getCamera()-getViewMatrixAsLookAt(eye,center,up);

osg::Vec3Array* verts = new osg::Vec3Array;
verts-push_back(eye);
 verts-push_back(osg::Vec3(20,20,20));
geometry-setVertexArray(verts);

osg::Vec4Array* colors = new osg::Vec4Array;
colors-push_back(osg::Vec4(0,1,0,1));
 geometry-setColorArray(colors);
geometry-setColorBinding(osg::Geometry::BIND_OVERALL);

geometry-addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::LINES,0,verts-size()));

float radius = 0.8f;
 float height = 1.0f;

osg::TessellationHints* hints = new osg::TessellationHints;
 hints-setDetailRatio(0.5f);

geode-addDrawable(new osg::ShapeDrawable(new
osg::Sphere(osg::Vec3(20.0f,20.0f,20.0f),radius),hints));

geode-dirtyBound();

}
protected:
 osgViewer::Viewer* mViewer;
};

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Background image...

2009-12-19 Thread Paul Martz
You can use an additional Camera for this, but that's really overkill 
for a fullscreen quad.


I would just draw a quad. Use a low render bin so that it renders first. 
Use a vertex shader to do the transform (make it fullscreen and put it 
on the far plane) and a fragment shader for the texturing. Set the depth 
test to ALWAYS and disable the parent camera clear.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ http://www.skew-matrix.com/
+1 303 859 9466



Trajce Nikolov wrote:

Hi Alessandro,

nah. That wont do the job. I did a quick test, and here is how I made it
work

go the the osgHUD example and:

1. createHUD, set for the camera:
camera-setRenderOrder(osg::Camera::NESTED_RENDER);

2. in main, about line 362, where you load your scene without arguments
osg::ref_ptrosg::Group group  = new osg::Group;
osg::Node* one = createHUD(); // this will be your background image
osg::Node* two = scene.get();
one-getOrCreateStateSet()-setRenderBinDetails(1,RenderBin);
two-getOrCreateStateSet()-setRenderBinDetails(2,RenderBin);
group-addChild(one);
group-addChild(two);
group-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
two-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);

// add the HUD subgraph.
//if (scene.valid()) group-addChild(scene.get());
//group-addChild(createHUD());

// set the scene to render
viewer.setSceneData(group.get());


this is working code. Might be another way, but this will help you I think

Let me know if it works for you

Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey

On Sat, Dec 19, 2009 at 11:16 AM, alessandro terenzi a.tere...@gmail.comwrote:


I'd like to create a fixed background for an osg application, much like a
HUD but while the HUD is always on top of the scene, I need to have an image
always behind any 3D object.

I tried to modify the example about HUDs by changing:

setRenderOrder(osg::Camera::POST_RENDER);

into this:

setRenderOrder(osg::Camera::PRE_RENDER);

but I guess that this is not sufficent to achive my goal, because actually
the background image is not displayed at all (or maybe it is covered by the
scene...).

How can I create the desired effect?
Thanks in advance.
Alessandro

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







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

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


Re: [osg-users] getCamera matrix in update callback

2009-12-19 Thread Paul Martz
You appear to be drawing it from the eye to a hardcoded point. I think 
you need to compute the location of a point directly in front of the 
eye, and draw the line from there to the hardcoded point (if I am 
understanding what you are trying to do correctly).


If I remember correctly, getViewMatrixAsLookAt takes an implicit 
parameter to define the distance from the eye to the center point that 
it returns. So, if you supply that distance, the you should be able to 
draw a line from center to a hardcoded value.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ http://www.skew-matrix.com/
+1 303 859 9466



Trajce Nikolov wrote:

Hi,

with the following setup I expect to have a line from the center of the
screeen to the point hard coded. It not that case. Any ideas?

Thanks

this is geode update callback


class UpdateCallback : public osg::NodeCallback
{
public:
UpdateCallback(osgViewer::Viewer* viewer)
 : mViewer(viewer)
{
}

virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
 osg::Geode* geode = dynamic_castosg::Geode*(node);
if (!geode) return;

geode-removeDrawables(0,geode-getNumDrawables());

osg::Geometry* geometry = new osg::Geometry;
 geode-addDrawable(geometry);

osg::Vec3 eye;
osg::Vec3 center;
 osg::Vec3 up;
mViewer-getCamera()-getViewMatrixAsLookAt(eye,center,up);

osg::Vec3Array* verts = new osg::Vec3Array;
verts-push_back(eye);
 verts-push_back(osg::Vec3(20,20,20));
geometry-setVertexArray(verts);

osg::Vec4Array* colors = new osg::Vec4Array;
colors-push_back(osg::Vec4(0,1,0,1));
 geometry-setColorArray(colors);
geometry-setColorBinding(osg::Geometry::BIND_OVERALL);

geometry-addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::LINES,0,verts-size()));

float radius = 0.8f;
 float height = 1.0f;

osg::TessellationHints* hints = new osg::TessellationHints;
 hints-setDetailRatio(0.5f);

geode-addDrawable(new osg::ShapeDrawable(new
osg::Sphere(osg::Vec3(20.0f,20.0f,20.0f),radius),hints));

geode-dirtyBound();

}
protected:
 osgViewer::Viewer* mViewer;
};

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey





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

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


Re: [osg-users] getCamera matrix in update callback

2009-12-19 Thread Trajce Nikolov
Hi Paul,

I did that as well. Instead of drawing the line from the eye I draw it from
the center (the result from getViewMatrixAsLookAt).

when the scene is static, means no camera move, it draws from the centar,
when I move the scene it jums all around. Please give it a try and let me
know if that is a bug somewhere or I am doing something wrong

Thanks!
Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey

On Sat, Dec 19, 2009 at 8:42 PM, Paul Martz pma...@skew-matrix.com wrote:

 You appear to be drawing it from the eye to a hardcoded point. I think you
 need to compute the location of a point directly in front of the eye, and
 draw the line from there to the hardcoded point (if I am understanding what
 you are trying to do correctly).

 If I remember correctly, getViewMatrixAsLookAt takes an implicit parameter
 to define the distance from the eye to the center point that it returns.
 So, if you supply that distance, the you should be able to draw a line from
 center to a hardcoded value.

 Paul Martz
 Skew Matrix Software LLC
 _http://www.skew-matrix.com_ http://www.skew-matrix.com/
 +1 303 859 9466



 Trajce Nikolov wrote:

 Hi,

 with the following setup I expect to have a line from the center of the
 screeen to the point hard coded. It not that case. Any ideas?

 Thanks

 this is geode update callback


 class UpdateCallback : public osg::NodeCallback
 {
 public:
 UpdateCallback(osgViewer::Viewer* viewer)
  : mViewer(viewer)
 {
 }

 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
 {
  osg::Geode* geode = dynamic_castosg::Geode*(node);
 if (!geode) return;

 geode-removeDrawables(0,geode-getNumDrawables());

 osg::Geometry* geometry = new osg::Geometry;
  geode-addDrawable(geometry);

 osg::Vec3 eye;
 osg::Vec3 center;
  osg::Vec3 up;
 mViewer-getCamera()-getViewMatrixAsLookAt(eye,center,up);

 osg::Vec3Array* verts = new osg::Vec3Array;
 verts-push_back(eye);
  verts-push_back(osg::Vec3(20,20,20));
 geometry-setVertexArray(verts);

 osg::Vec4Array* colors = new osg::Vec4Array;
 colors-push_back(osg::Vec4(0,1,0,1));
  geometry-setColorArray(colors);
 geometry-setColorBinding(osg::Geometry::BIND_OVERALL);

 geometry-addPrimitiveSet(new
 osg::DrawArrays(osg::PrimitiveSet::LINES,0,verts-size()));

 float radius = 0.8f;
  float height = 1.0f;

 osg::TessellationHints* hints = new osg::TessellationHints;
  hints-setDetailRatio(0.5f);

 geode-addDrawable(new osg::ShapeDrawable(new
 osg::Sphere(osg::Vec3(20.0f,20.0f,20.0f),radius),hints));

 geode-dirtyBound();

 }
 protected:
  osgViewer::Viewer* mViewer;
 };

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey



 

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

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

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


[osg-users] 3D Max lights

2009-12-19 Thread Danny Lesnik
Hi,

I created scene in 3D studio max and set up appropriate light. 
When I'm loading this 3DS in the OSG I don't have these lights enabled. 

I tried to turn on the lights on these specific node however it did not solved 
the problem. 

I tried the following: 

cessnaNode = osgDB::readNodeFile(C:\\Lights.3DS);
osg::StateSet *state = cessnaNode-getOrCreateStateSet();
state-setMode( GL_LIGHTING, osg::StateAttribute::PROTECTED | 
osg::StateAttribute::ON );

How can I enable original lights from 3D studio Max? 

Thank you!

Cheers,
Danny

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





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


Re: [osg-users] DDS uncompressed RGB(A) / BGR(A)

2009-12-19 Thread Robert Osfield
Hi Sukender,

I'm not overly familiar with the dds plugin, but what you describe
sounds like a bug in writer in our dds plugin.

Robert.

On Fri, Dec 18, 2009 at 5:15 PM, Sukender suky0...@free.fr wrote:
 Hi all,

 It was discussed a long time ago but I dit not find an answer. Saving to DDS 
 an uncompressed RGB image and then loading from the file works: the loaded 
 image is the same as the original. However, the file is BGR (R and B 
 inverted). I tried three 3rd-party tools (image viewer/converters) and all 
 display the same.
 Do you think this is a bug in DDS readerwriter? Anyone has a clue about it?
 Thanks a lot.

 Sukender
 PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-19 Thread Robert Osfield
Hi Massimo,

On Fri, Dec 18, 2009 at 6:04 PM, Massimo Tarantini subbi...@yahoo.it wrote:
 I have attached 3 Images to show what i mean.
 In the image moving_slow.jpg the camera is moving slowly towards the 
 mountains, and the snow looks like rays of light coming out of the screen.

The pictures didn't come through.  I use the mailing lists, but
checked the forum thread and it doesn't show any pictures either.

From your description it sounds like an issue that occurs when the
camera moves very fast relative to the particle system, rather than
very slow.  My only guess is that you've model units that aren't in
meters so the velocities are out.

Try the precipitation example to see if it works fine.


 With vync do you mean Wait Vertical Update ON/OFF?
 I have tried both in ATI Control Panel, and nothing change.

vysnc is Vertical Sync (of the graphics swap buffers with monitor
refresh), with will be likely Wait Vertex Update in your control
panel.

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