Re: [osg-users] Picking Problem PolytopeIntersector

2009-04-29 Thread Raphael Sebbe
Hi,

I second Paul on that. Generally speaking, you need some kind of tolerance
(or margin) when picking for best user experience. Users dont want to spend
time trying to pick an object. And that's exactly what polytope is about.
But if you only have large objects (pixel size) in your application, well,
line intersector may be just fine.

Raphael

On Fri, Apr 24, 2009 at 8:04 PM, Jean-Sébastien Guay 
jean-sebastien.g...@cm-labs.com wrote:

 Hi Paul,

  When you do a mouse pick, you generally are trying to pick an object that
 falls into a small screen-space box around the cursor. In a perspective
 view, the box has smaller world-space extents at the near plane, and
 larger
 world-space extents at the far plane. In essence, it looks like a view
 frustum. PolytopeIntersector is the only intersector that accurately
 represents this pick volume.


 Yes, but this is only a problem if the user clicks on the pixels at the
 edge of the object (or the limit case, if the object occupies only one pixel
 on screen). The chances that the user will click just at the edge of the
 object and the ray will miss are really small. Generally the object is big
 enough on screen (even if the object occupies 5x5 pixels I'd be surprised to
 see a user click on the edge, most of the time they'll click in the middle).

 Every developer is free to make the choices they want. I consider this case
 much too infrequent, and it has not been a problem for us. I have not had
 one user tell me hey, I should have selected the object then but I didn't.

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.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] Point matching / Affine transforms

2009-04-29 Thread Riccardo Corsi

Hi Martin,

if you have 2 data sets and a bunch of of feature-points among them to 
be aligned, I suggest you to try the Iterative Closest Point algorithm

http://en.wikipedia.org/wiki/Iterative_Closest_Point

I've used it in the past to align 2 partially matching surfaces, and it 
proved to be very efficient and quick.


HTH,
Ricky



On 27/04/2009 22.51, Martin Beckett wrote:

I need to align two data sets in OSG by fitting a small number of key points 
and calculating the translation/rotation matrices.

Normally this is done with a Helmert transform, that defines 7 parameters (xyz 
translate, xyz rotate, linear scale) to convert between map coordinates.
GDAL seems to use Affine transforms instead - it has routine to apply 
transforms but I can't find anything to calculate them.

First has anyone else already done this?
Second - since it's going to involve pulling in a lot of Least-Squares/SVD or 
other solver code is there a preferred numerical library?

Martin

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





___
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] Shadows textures

2009-04-29 Thread Patrick Pogscheba
Hi,

when i load a model with a texture (.flt or .dae, texture format png or jpg) 
into my shadowed scene,  the textures won't be displayed. Are there any hints 
to fix this issue ? I've tested the models with the osgshadow-example with the 
same results... in a non-shadowed scene everything's fine ?

With LISP-ShadowMaps the textures are somehow projected onto my model from a 
wrong view (it seems like the camera-view) and only the contours are visible?

I've tested some of the shadow parameters but couldn't achive a result...

Thank you for your help 

Patrock

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





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


Re: [osg-users] osgEarth + OSG 2.8.0 + ATI card

2009-04-29 Thread Emmanuel Roche
Hi Jason,

thanks for your answer. Actually, I just downloaded 2.8.1 rc3, built  it and
tested my software with those binaries: it solved to problem !!... to some
extends... :-(

Actually, i think i'm now facing another ATI specific issue: I can start my
app, retrieve image and elevation tiles and built my earth model... except
that after some time (and this is also true if I use an simple example like
osgviewer yahoo_aerial.earth) it seems that my ATI just start mixing all
the loaded textures!

And in fact it seems to be a quite advanced feature as the mixing is
progressive !!! (ie. We have a nice fading effect when you move slowing !!)

My guess is, it could be that the graphic card memory is filled with
textures, and then the ATI driver start using old texture objects
depending on your distance to your model expecting to create a nice fading
effect (assuming what we have here are mipmaped textures ?) (except that
osgEarth keeps updating all the textures any way, so old textures for a
given area are actually replaced by other textures for other areas). Could
this make sense ? (or maybe I'm just saying silly things I'm really not an
expert when it comes to the low level details like that :-) ).

I'm joining a couple of screen capture in a following mail: maybe someone
already faced this before.

Manu.


2009/4/28 Jason Beverage jasonbever...@gmail.com

 Hi Emmanuel,

 Glad to hear osgEarth is working out for you:)

 Try disabling VBO's by setting the OSG_GL_EXTENSION_DISABLE environment
 variable to GL_ARB_vertex_buffer_object.

 This is really a temporary solution, once 2.8.1 is out the door, you can
 probably just upgrade and it should work fine.

 Thanks!

 Jason

 On Tue, Apr 28, 2009 at 6:12 AM, Emmanuel Roche 
 roche.emman...@gmail.comwrote:

 Hi everyone !

 I've been testing osgEarth for a few days now: it works perfectly on my
 nvidia cards.

 But when trying the same application with an ATI cards, the app just
 shutdowns on some cards, or crashes (with the error mentioned on the
 osgEarth forum here: http://n2.nabble.com/Ati-error-td2603275.html )

 I've read that the rc3 for OSG 2.8.1 comes with a fix item : fixes to
 display lists/vbo creation that prevent crash under ATI drivers. My
 question is : do you know if this is related to the problem I'm experiencing
 currently and has someone already tested osgEarth on a previously crashing
 ATI cards with that version of OSG ?

 best regards,
 Manu.


 ___
 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] [osgPlugins] Failed to read unsigned int value??

2009-04-29 Thread Akilan
Hi
.
I am using VPB 0.9.1 only for OSG2.2

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





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


Re: [osg-users] Brand New BlackBerry Storm 9500--$250 for sale.

2009-04-29 Thread Art Tevs
Robert, yes, it happens that spammers just do register on forums to post 
something there. Mailing lists doesn't look that attractive as forums, therefor 
there are human controlled spam bots around. In almost 4 months of forum 
existing there were 2 spam messages out of around 3000 usual messages, so the 
rate of spamming is still very low.

However, you are right that 2 are already to much. I am currently working on 
the possibility to moderate only the first message of any user. However this 
takes time, since there are no real good mods for the phpbb forum exists, which 
can do that. So guys, please be patient, I will try to come up with a solution 
for that.

Cheers,
art

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





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


Re: [osg-users] osgEarth + OSG 2.8.0 + ATI card

2009-04-29 Thread Robert Osfield
Hi Manu,

On Wed, Apr 29, 2009 at 9:27 AM, Emmanuel Roche
roche.emman...@gmail.com wrote:
 Actually, i think i'm now facing another ATI specific issue: I can start my
 app, retrieve image and elevation tiles and built my earth model... except
 that after some time (and this is also true if I use an simple example like
 osgviewer yahoo_aerial.earth) it seems that my ATI just start mixing all
 the loaded textures!

 And in fact it seems to be a quite advanced feature as the mixing is
 progressive !!! (ie. We have a nice fading effect when you move slowing !!)

This sounds like it might be mip mapping at fault.  I've not seen this
first hand on the ATI card I'm testing with, but I've heard about the
issue over the years w.r.t ATI cards.

Try updating your OpenGL driver.

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


Re: [osg-users] [osgPlugins] Failed to read unsigned int value??

2009-04-29 Thread Robert Osfield
On Wed, Apr 29, 2009 at 10:02 AM, Akilan akilan.thangam...@gmail.com wrote:
 Hi
 .
 I am using VPB 0.9.1 only for OSG2.2

And any idea what version that .ive database was built for?

In general I have to recommend that you upgrade to OSG-2.8.0/2.8.1-rc*
and VPB 0.9.10 as they both have lots of bug fixes applied to them.

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


Re: [osg-users] Brand New BlackBerry Storm 9500--$250 for sale.

2009-04-29 Thread Robert Osfield
On Wed, Apr 29, 2009 at 10:19 AM, Art Tevs arti_t...@yahoo.de wrote:
 Robert, yes, it happens that spammers just do register on forums to post 
 something there. Mailing lists doesn't look that attractive as forums, 
 therefor there are human controlled spam bots around. In almost 4 months of 
 forum existing there were 2 spam messages out of around 3000 usual messages, 
 so the rate of spamming is still very low.

 However, you are right that 2 are already to much. I am currently working on 
 the possibility to moderate only the first message of any user. However this 
 takes time, since there are no real good mods for the phpbb forum exists, 
 which can do that. So guys, please be patient, I will try to come up with a 
 solution for that.

Thanks for looking in to this.  It has to be a general problem that
other forums see, so getting at patch for forum.openscenegraph.org may
well make lives easier for other communities as well.

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


[osg-users] Shadows: Application crashing at viewer.renderingTraversals()

2009-04-29 Thread Paul
Hi,

Im trying to add shadows to my scene, code taken from osgshadow example but my 
application crashes when it gets to  viewer.renderingTraversals().

If I dont set the setShadowTechnique then my application does not crash, but i 
obviously don't get shadows either. Ive tried each of the shadow techniques 
without sucess.

Heres my code, can you see any mistakes?
Thank you.
Paul.


Code:
#include stdio.h
#include osgViewer/CompositeViewer
#include osgViewer/Viewer
#include osgGA/TrackballManipulator

#include osgShadow/ShadowedScene
#include osgShadow/ShadowVolume
#include osgShadow/ShadowTexture
#include osgShadow/ShadowMap
#include osgShadow/SoftShadowMap
#include osgShadow/ParallelSplitShadowMap
#include osgShadow/LightSpacePerspectiveShadowMap
#include osgShadow/StandardShadowMap
#include osg/ComputeBoundsVisitor

static int ReceivesShadowTraversalMask = 0x1;
static int CastsShadowTraversalMask = 0x2;

int main(int argc, char **argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(argc, argv);

// construct the viewer.
osgViewer::CompositeViewer viewer(arguments);

// Turn on FSAA, makes the lines look better.
//osg::DisplaySettings::instance()-setNumMultiSamples( 4 );

osg::ref_ptrosgShadow::ShadowedScene shadowedScene = new 
osgShadow::ShadowedScene;


shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask);

osg::ref_ptrosgShadow::ShadowMap sm = new osgShadow::ShadowMap;
shadowedScene-setShadowTechnique(sm.get());
sm-setTextureSize(osg::Vec2s(1024, 1024));

//osg::ref_ptr osg::Group  root = new osg::Group;
osg::ref_ptr osg::Node  scene;
scene = osgDB::readNodeFile(cow.osg);

// set up the texture of the base.
osg::StateSet* stateset = new osg::StateSet();
osg::Image* image = osgDB::readImageFile(Images/lz.rgb);
if (image)
{
osg::Texture2D* texture = new osg::Texture2D;
texture-setImage(image);
stateset-setTextureAttributeAndModes(0, texture, 
osg::StateAttribute::ON);
}

scene-setStateSet(stateset);

scene-setNodeMask(CastsShadowTraversalMask | 
ReceivesShadowTraversalMask);

osg::Vec4 lightpos;

lightpos.set(0.5f, 0.25f, 0.8f, 0.0f);

osg::ref_ptrosg::LightSource ls = new osg::LightSource;

ls-getLight()-setPosition(lightpos);

ls-getLight()-setAmbient(osg::Vec4(0.2, 0.2, 0.2, 1.0));
ls-getLight()-setDiffuse(osg::Vec4(0.8, 0.8, 0.8, 1.0));

osg::ref_ptrosg::MatrixTransform sceneTransform = new 
osg::MatrixTransform();
osg::Matrix zTrans = osg::Matrix::translate(0.0f, 0.0f, 0.0f);
sceneTransform-setMatrix(zTrans);
sceneTransform-addChild(scene.get());
shadowedScene-addChild(sceneTransform);

osg::ref_ptrosg::MatrixTransform sceneTransform2 = new 
osg::MatrixTransform();
osg::Matrix zTrans2 = osg::Matrix::translate(1.5f, 0.0f, 1.5f);
sceneTransform2-setMatrix(zTrans2);
sceneTransform2-addChild(scene.get());
sceneTransform-addChild(sceneTransform2);

shadowedScene-addChild(ls.get());

osgGA::TrackballManipulator* manipulator;
osgGA::TrackballManipulator* manipulator2;

// Create Editor View
{
osgViewer::Viewer* view = new osgViewer::Viewer();
viewer.addView(view);
osg::Camera* camera = view-getCamera();
camera-setViewport(new osg::Viewport(0, 0, 640, 480));
GLenum buffer = GL_BACK;
camera-setDrawBuffer(buffer);
camera-setReadBuffer(buffer);
camera-setClearColor(osg::Vec4(0.0, 0.0, 0.0, 1.0)) ;
camera-setCullingMode(camera-getCullingMode()  
~osg::CullStack::SMALL_FEATURE_CULLING);
view-setSceneData(shadowedScene.get());
manipulator = new osgGA::TrackballManipulator;
view-setCameraManipulator(manipulator);
manipulator-setHomePosition(osg::Vec3(0, -10, 0), osg::Vec3(0, 
0, 0), osg::Vec3(0, 0, 5));
view-setUpViewInWindow(20, 20, 640, 480);
}

// Create Controls View
{
osgViewer::Viewer* view = new osgViewer::Viewer();
viewer.addView(view);
osg::Camera* camera = view-getCamera();
camera-setViewport(new osg::Viewport(0, 0, 640, 480));
GLenum buffer = GL_BACK;
camera-setDrawBuffer(buffer);
camera-setReadBuffer(buffer);
camera-setClearColor(osg::Vec4(0.0, 0.0, 0.0, 1.0)) ;
camera-setCullingMode(camera-getCullingMode()  
~osg::CullStack::SMALL_FEATURE_CULLING);

Re: [osg-users] OpenSceneGraph always opening in fullscreen on Intel integrated graphics.

2009-04-29 Thread René Molenaar
We have had similar complaints with a qt3.3.8 integrated viewer.In our case
a composite viewer with four views with splitters in between.

I found one 'workaround' which is:
 go to the advanced display settings, advanced, troubleshoot and ...
disable hardware acceleration ... .. pff...

but the Intel graphics drivers sometimes don't provide this menu.
If I check the log (with set OSG_NOTIFY_LEVEL=DEBUG) i see:

GraphicsContext::registerGraphicsContext 07391228
close(1)07391228
close(0)07391228
GraphicsContext::unregisterGraphicsContext 07391228
Viewer::startThreading() - starting threading
Viewer::startThreading() - contexts.size()=0


while I should see:

GraphicsContext::registerGraphicsContext 0x95187f8
Relaxing traits
GraphicsContext::createNewContextID() creating contextID=0
Updating the MaxNumberOfGraphicsContexts to 1
Viewer::startThreading() - starting threading
Viewer::startThreading() - contexts.size()=1

Any suggestions are very welcome.

Rene

2009/4/27 Jesper D. Thomsen j...@anybodytech.com

  Hi, I'm not currently using multisampling in the window, as we have an
 option in the application where we can switch to an older OpenGL renderer
 for the viewport, and this older implementation doesn't like multisampling.
 I'm however not having any problems with OpenGL state, as I don't use any
 direct OpenGL in the cases where I'm having the fullscreen problem.
 I just dug up an old computer with integrated Intel 82865G graphics (which
 supports OpenGL 1.3), and that computer works fine with windowed
 OpenSceneGraph use (even with standard Windows XP graphics drivers).

 regards,


 Jesper D. Thomsen

 **

  --
 *From:* osg-users-boun...@lists.openscenegraph.org [
 osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ümit Uzun [
 umituzu...@gmail.com]
 *Sent:* Monday, April 27, 2009 11:14 AM
 *To:* OpenSceneGraph Users
 *Subject:* Re: [osg-users] OpenSceneGraph always opening in fullscreen on
 Intel integrated graphics.

   Hi Jesper;

 As I can see from attached codes you didn't used traits-samples = (any int
 value); but you may be set multisampling in your code from using

 osg::DisplaySettings* ds = new osg::DisplaySettings();
 ds-setNumMultiSamples( 4 );

 or osgUtil namespaces function(I have forgotten the name of this
 function.).

 If you try to anti aliasing operation by using MultiSampling, this could be
 cause full screen problem which I had had kind of that before and solved by
 removing multisampling operation.

 HTH.Regards.

 2009/4/27 Jesper D. Thomsen j...@anybodytech.com

  Hi all (again), and thanks for your help in the past.

 We have now shipped an application using OpenSceneGraph for the 3D
 viewports of a model. We are now receiving a couple of bug-reports (2 so
 far) from users running the application on laptops with Intel integrated
 graphics (GMA 950 and 3100). We are using OpenSceneGraph in an MFC window in
 the application, but whenever these two users open the viewport window (and
 thus starting the OpenSceneGraph part of the application), the
 OpenSceneGraph viewer starts in fullscreen (no menus or windows bar
 visible), which of course means that they have to use the task manager to
 quit the application.

 Both users are using Windows XP pro. The OSG version used is 2.6.1,
 compiled with Visual Studio 2005 SP1 under Vista. The application is using
 MFC, and the OpenSceneGraph viewport is based on the MFCViewer example. The
 code for creating the viewer can be found below. Does anybody know why OSG
 suddenly will be forced to work in fullscreen, and is it generally because
 of some specific lack of OpenGL support?

 Any help will be much appreciated.

 --- Code: --

 void
 cOSG::InitCameraConfig(void)

 {

 // Local Variable to hold window size data

 RECT rect;

 // Create the viewer for this window

 mViewer =
 new osgViewer::Viewer();

 mViewer-setThreadingModel(osgViewer::Viewer::SingleThreaded);

 // Get the current window size

 ::GetWindowRect(m_hWnd, rect);

 // Init the GraphicsContext Traits

 osg::ref_ptrosg::GraphicsContext::Traits traits =
 new osg::GraphicsContext::Traits;

 // Init the Windata Variable that holds the handle for the Window to
 display OSG in.

 osg::ref_ptrosg::Referenced windata =
 new osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);

 // Setup the traits parameters

 traits-x = 0;

 traits-y = 0;

 traits-width = rect.right - rect.left;

 traits-height = rect.bottom - rect.top;

 traits-windowDecoration =
 false;

 traits-doubleBuffer =
 true;

 traits-sharedContext = 0;

 traits-setInheritedWindowPixelFormat =
 true;

 traits-inheritedWindowData = windata;

 // Create the Graphics Context

 osg::GraphicsContext* gc =
 osg::GraphicsContext::createGraphicsContext(traits.get());

 // Init a new Camera (Master for this View)

 camera = mViewer-getCamera();

 // Assign Graphics Context to the Camera

 camera-setGraphicsContext(gc);

 // Set the viewport for the Camera

 camera-setViewport(
 

[osg-users] Blender/Maya importer

2009-04-29 Thread Meyer
Hi,

To be honest, I switched from OSG to OGRE some time ago, but hopefully yo will 
forgive me and help me with my problem.

I need to establish a communication between an OGRE-visualisation and an 
OSG-framework, that produces .ive-files. Is it possible to convert these 
ive-files into ogre .meshes and .materials directly, or at least into a file 
Blender, Maya or 3DStudioMax could read? 
In your wiki I found a Blender exporter, transforming into OSG, but not the 
other way round. And the links to osgmaya (an importer for Maya) and a similar 
program for 3DS didnt work. As Blender is a freeware, it would be really great 
to be able to import and visualize .ive-scenes in it (I could then export it to 
.mesh for OGRE).
Does anyone of you know a (working) importer for Blender?

Thank you a lot!

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





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


Re: [osg-users] Point matching / Affine transforms

2009-04-29 Thread Martin Beckett
In my application I know that the points are an almost perfect match - I just 
need to snap two models together based on key points.

ICP is good for fitting surfaces together (although there are a bunch of other 
relaxation type algorithms that work).

I was mainly looking for something that could be implemented fairly simply 
rather than having to include the whole of CGAL or LAPACK.

Martin

ps. If you have some ICP example code - that would be great!

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





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


Re: [osg-users] osgEarth + OSG 2.8.0 + ATI card

2009-04-29 Thread Emmanuel Roche
Hi Robert,

I've already updated my drivers... yesterday :-) So I'm afraid this won't
help so much for now.

Can you tell me which ATI card you are using ?

We are experiencing the same problems here with a Mobility Radeon X1900
and a Radeon HD 3650.

Manu.



2009/4/29 Robert Osfield robert.osfi...@gmail.com

 Hi Manu,

 On Wed, Apr 29, 2009 at 9:27 AM, Emmanuel Roche
 roche.emman...@gmail.com wrote:
  Actually, i think i'm now facing another ATI specific issue: I can start
 my
  app, retrieve image and elevation tiles and built my earth model...
 except
  that after some time (and this is also true if I use an simple example
 like
  osgviewer yahoo_aerial.earth) it seems that my ATI just start mixing
 all
  the loaded textures!
 
  And in fact it seems to be a quite advanced feature as the mixing is
  progressive !!! (ie. We have a nice fading effect when you move slowing
 !!)

 This sounds like it might be mip mapping at fault.  I've not seen this
 first hand on the ATI card I'm testing with, but I've heard about the
 issue over the years w.r.t ATI cards.

 Try updating your OpenGL driver.

 Robert.
 ___
 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] Point matching / Affine transforms

2009-04-29 Thread Riccardo Corsi

Hi Martin,

unfortunately I don't have any example code to share right now...
I've seen from wikipedia that c++ and matlab implementation exist, maybe 
you can take a look.


I can guarantee that if you have good feature points, the algorithm is 
going to run fast and give good results.
I had done a lot of work to extract significant feature points from my 
clouds.


What I can also suggest is to try some of the variants suggested here, 
they really improve speed and stability:
Efficient Variants of the ICP Algorithm 
http://graphics.stanford.edu/papers/fasticp/ 
http://graphics.stanford.edu/papers/fasticp/


Good luck!
Ricky


On 29/04/2009 15.13, Martin Beckett wrote:

In my application I know that the points are an almost perfect match - I just 
need to snap two models together based on key points.

ICP is good for fitting surfaces together (although there are a bunch of other 
relaxation type algorithms that work).

I was mainly looking for something that could be implemented fairly simply 
rather than having to include the whole of CGAL or LAPACK.

Martin

ps. If you have some ICP example code - that would be great!

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





___
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] osgEarth + OSG 2.8.0 + ATI card

2009-04-29 Thread Robert Osfield
On Wed, Apr 29, 2009 at 2:29 PM, Emmanuel Roche
roche.emman...@gmail.com wrote:
 Hi Robert,

 I've already updated my drivers... yesterday :-) So I'm afraid this won't
 help so much for now.

 Can you tell me which ATI card you are using ?

I have a 4670.

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


Re: [osg-users] Picking Problem PolytopeIntersector

2009-04-29 Thread Jean-Sébastien Guay

Hello Martin,


I have a model with lots of points and  I want to find the front/first point 
under the mouse click (quickly)

Options are a polytrope intersector with a small box (2x2 5x5 pixels).
What if I used a few line lineintersectors spaced a pixel apart, would that be 
faster?


LineSegmentIntersector will not find points (at all). Even for 3D 
geometry, I wouldn't suggest using multiple LineSegmentIntersections 
because then you might miss objects (between the lines) - you're subject 
to sampling issues.


PolytopeIntersector will not order results in closest-first fashion, but 
for points, you can do that yourself. Just order by the distance between 
the camera's eye point and the given point.


This is possible for points but not for general geometry, for example 
imagine a bowl containing fruit, and picking from above:


||
||   polytope
\   |  / |
 \/ bowl with fruit
  \_oOOo_/

The polytope above will pick both the fruit and the bowl, but which one 
is closest? The bowl is closest for part of the polytope, but the fruit 
are closest for another part.


Since points are zero-dimensional you can order them by distance without 
ambiguity.



Also is there a way to use the colour under the mouse cursor to quickly check 
if there is a point (by comparing to background) before doing the intersector?


You could do that yourself by doing a readPixel in the mouse x,y point 
that was clicked. But it might be slow because it will flush the 
graphics fifo, and in general it won't work because the background might 
not be the clear color (if you have a skydome/skybox, or an environment 
in your scene).


But if you want to try it, the way I'd do this is to delay the actual 
picking for one frame. Have your event handler add a camera post-draw 
callback that does an osg::Image::readPixels for the current camera and 
checks for those x,y. If there's an object there, it can then do the 
actual intersection test or whatever you want. The camera post-draw 
callback then removes itself (so it isn't used for all frames, just the 
frames where a pick was attempted - the osgViewer::ScreenCaptureHandler 
does this so that it takes a screenshot only once).


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Problem with ReadWriterOSG.cpp and osgDB::setDataFilePathList

2009-04-29 Thread Morgan Willis
Hi All,

 

I have an issue with loading .osg files.  I would like to be able to
specify the directories from which the internally referenced files of a
.osg file are loaded.   This can largely be achieved by using
osgDB::setDataFilePathList or setting the database path on an instance
of ReaderWriter::Options when calling osgDB::readNodeFile.  However I
have a problem.  Internally referenced files in the same directory as
the .osg file (current directory) will always be preferred to those in
other directories specified on the data path list even if the current
directory is on the data path list.  This is causing me problems when
trying to do resource localisation in the following way:

 

The directory Test (see below) contains a default version of bar.png,
directories fr-FR and en-GB containing localised versions of bar.png and
foo.osg that references bar.png.

 

Test

foo.osg

bar.png

fr-FR

bar.png

en-GB

bar.png

 

What I would like to happen is that bar.png in fr-FR is loaded instead
of the default when the data path is setup as (Test/fr-FR/,Test/).  If
bar.png doesn't exist in the localised directory then the default is
loaded.  What is stopping this happening is the following line in
.../src/osgPlugins/ReadWriterOSG.cpp



local_opt-getDatabasePathList().push_front(osgDB::getFilePath(fileName)
);

 

This always adds the directory of the .osg file to the front of the data
path list so internally referenced files will always be loaded from that
directory irrespective of how the data path has initially been
constructed.

 

There are a number of ways ReadWriterOSG.cpp could be changed to resolve
this issue:

1.   Only add the  directory of the .osg file if it isn't already on
the data path.

2.   Add a flag to ReaderWriter::Options to indicate that the
directory should not be added to the path.

3.   Some combination of 1 and 2.

This logic could be put into ReaderWriter::Options to make it available
to other plugins.

 

Any ideas?

 

Thanks,

 

Morgan.

 

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


Re: [osg-users] PagedLOD

2009-04-29 Thread Jakob Ruhe
I think you can solve what you want by making sure your own pseudo
loader is used instead. You do this by adding some extension
(.ott_terrain, .ott_model, ...) to the filenames of the children of
your PagedLODs and you register a ReaderWriter that supports those
extensions. You can then in your ReaderWriter remove the extension and
load the real file with the right loader by calling
osgDB::readNodeFile as usual and then do the postprocessing of the
node. Note that all this will be done in a thread created by
DatabasePager. If you need to do some postprocessing in your main
scenegraph thread you can add a callback (update callback or cull
callback) to the node.

If you need an example how this can be done please have a look at osgEarth.

Good luck!

/Jakob Ruhe

2009/4/28 Alan Ott a...@signal11.us:
 Robert and Bryan,

 Thanks for the info. From this, it seems like I can get a handle to the
 newly loaded node before it gets added to the main tree. The only thing now
 is that once I've got a handle to this node, I don't really know _what_ the
 node is supposed to be (is it a terrain tile, a moving model? etc.).

 ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it seems
 like I could make a new option string telling me how to post-process this
 model load, but I can't see how in PagedLOD to set ReaderWriterOptions.

 PagedLOD has the setDatabaseRequest() function, which based on another
 mailing list post, looks like it is to be used as a user data pointer. The
 problem here is that I don't know how to get this object from inside the
 ReadFileCallback.

 I simply need to tag each request (made by the PagedLOD) as terrain or
 model so that I know specifically what initialization to do in the
 ReadFileCallback.

 Am I missing something obvious here?

 Thanks for your help,

 Alan.


 Robert Osfield wrote:

 Hi Alan,

 As Bryan wrote, what you need is to write a custom
 osgDB::Registry::ReadFileCallback that will intercept all DB calls,
 you then leave it up to Registry itself to the do the reading from the
 plugin, but then you process the loaded data before passing the end
 result back from the callback.  Have a look at the ReadFileCallback
 implementation and study the default implementations, this should give
 you a clue how to put it together.

 Robert.

 On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott a...@signal11.us wrote:


 Hello,

 I'm using PagedLOD to load terrain tiles off disk. The problem I have is
 that before I want the tile to actually render, I want to do a setup of the
 tile (to look up certain control nodes and set switches according to the
 current state of the system (eg: day/night mode, etc)).

 So on my own update(), I check to see if each PagedLOD has just loaded, and
 if it has, I run the initialization on it. The problem is, when a tile gets
 loaded, it is rendered for one frame _before_ I can do my initialization on
 it. So for one frame, it is drawn wrong, then the next frame, it is drawn
 right.

 I thought I might be able to get around this by setting the Node Mask to 0
 until it was initialized, but that seems to just keep the tiles from getting
 loaded entirely (because the update traverser isn't getting into the
 PagedLOD either).

 Do any of you have any ideas of what I could try to do to get around this?
 Is there some value of the NodeMask that I could use to enable update but
 not draw? Such a value did not seem to be documented in the API.

 Thanks for all your help,

 Alan.


 ___
 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


[osg-users] unable to glReadPixels in osg::Drawable::drawImplementation

2009-04-29 Thread Can Hosgor
Hi,

I'm trying to implement a custom osg::Drawable which need to check the depth 
component of a certain pixel before rendering itself. The problem is, 
glReadPixels always returns 1.0 (even for the entire viewport, which obviously 
should not be possible). I didn't touch the default settings of depth 
test/range. Can anyone guess what the problem might be?

... 

Thank you.

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





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


Re: [osg-users] unable to glReadPixels inosg::Drawable::drawImplementation

2009-04-29 Thread Tomlinson, Gordon
The best bet any of can give you is that your code is probably the
problem

But as you don't  show the code your usingwho knows 


Gordon
Product Manager 3d
__
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com
__


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Can
Hosgor
Sent: Wednesday, April 29, 2009 11:12 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] unable to glReadPixels
inosg::Drawable::drawImplementation

Hi,

I'm trying to implement a custom osg::Drawable which need to check the
depth component of a certain pixel before rendering itself. The problem
is, glReadPixels always returns 1.0 (even for the entire viewport, which
obviously should not be possible). I didn't touch the default settings
of depth test/range. Can anyone guess what the problem might be?

... 

Thank you.

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





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


[osg-users] frustum culling in shader

2009-04-29 Thread Emmanuel Roche
Hi everyone,

Just again a simple problem I can't solve myself:

I have an sphere object I want to use as a sky sphere. What's the best wait
to do that ???

The idea I came to is to use a vertex shader to offset each of the sphere
vertex by the current position of the camera in the model frame. But then
nothing is displayed because the moved vertices are behind the near plane
and are culled :-(

Any idea ?

I guess I'm not the first one trying to render a sky sphere any way ??

thanks for your help.

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


Re: [osg-users] Problem with ReadWriterOSG.cpp and osgDB::setDataFilePathList

2009-04-29 Thread Robert Osfield
Hi Morgan,

Adding a ReaderWriter::Option::OptionsString entry would probably be
the most straight forward way to hint to the plugins not include the
local file directory when searching.  Feel free to add the necessary
code to OSG plugin and submit the changes to the osg-submissions list.

Cheers,
Robert.

On Wed, Apr 29, 2009 at 3:43 PM, Morgan Willis
morg...@aristechnologies.com wrote:
 Hi All,



 I have an issue with loading .osg files.  I would like to be able to specify
 the directories from which the internally referenced files of a .osg file
 are loaded.   This can largely be achieved by using
 osgDB::setDataFilePathList or setting the database path on an instance of
 ReaderWriter::Options when calling osgDB::readNodeFile.  However I have a
 problem.  Internally referenced files in the same directory as the .osg file
 (current directory) will always be preferred to those in other directories
 specified on the data path list even if the current directory is on the data
 path list.  This is causing me problems when trying to do resource
 localisation in the following way:



 The directory Test (see below) contains a default version of bar.png,
 directories fr-FR and en-GB containing localised versions of bar.png and
 foo.osg that references bar.png.



 Test

     foo.osg

     bar.png

     fr-FR

     bar.png

     en-GB

     bar.png



 What I would like to happen is that bar.png in fr-FR is loaded instead of
 the default when the data path is setup as (Test/fr-FR/,Test/).  If bar.png
 doesn’t exist in the localised directory then the default is loaded.  What
 is stopping this happening is the following line in
 .../src/osgPlugins/ReadWriterOSG.cpp



 local_opt-getDatabasePathList().push_front(osgDB::getFilePath(fileName));



 This always adds the directory of the .osg file to the front of the data
 path list so internally referenced files will always be loaded from that
 directory irrespective of how the data path has initially been constructed.



 There are a number of ways ReadWriterOSG.cpp could be changed to resolve
 this issue:

 1.   Only add the  directory of the .osg file if it isn’t already on the
 data path.

 2.   Add a flag to ReaderWriter::Options to indicate that the directory
 should not be added to the path.

 3.   Some combination of 1 and 2.

 This logic could be put into ReaderWriter::Options to make it available to
 other plugins.



 Any ideas?



 Thanks,



 Morgan.



 ___
 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] PagedLOD

2009-04-29 Thread Thrall, Bryan
Alan Ott wrote on Tuesday, April 28, 2009 10:34 AM:
 Thanks for the info. From this, it seems like I can get a handle to
the newly
 loaded node before it gets added to the main tree. The only thing now
is that
 once I've got a handle to this node, I don't really know _what_ the
node is
 supposed to be (is it a terrain tile, a moving model? etc.).   
 
 ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it
seems
 like I could make a new option string telling me how to post-process
this
 model load, but I can't see how in PagedLOD to set
ReaderWriterOptions.  

Unfortunately, at the moment PagedLOD doesn't have a way to specify
ReaderWriterOptions (and adding that ability is a little complicated,
because we don't want a circular dependency between osg and osgDB).

One thing you can do is subclass PagedLOD in your app to add the ability
to specify a ReaderWriterOptions when it calls readNode().

 PagedLOD has the setDatabaseRequest() function, which based on another
 mailing list post, looks like it is to be used as a user data
pointer. The
 problem here is that I don't know how to get this object from inside
the
 ReadFileCallback.   

This makes me think you're using an older version of OSG? The latest OSG
in svn only has getDatabaseRequest() (which you can use to set the
DatabaseRequest). In any case, the database request isn't really for
user data; it is specifically for osgDB::DatabasePager use.

 Robert Osfield wrote:
   As Bryan wrote, what you need is to write a custom
   osgDB::Registry::ReadFileCallback that will intercept all DB
calls,
   you then leave it up to Registry itself to the do the reading
from the
   plugin, but then you process the loaded data before passing the
end
   result back from the callback.  Have a look at the
ReadFileCallback
   implementation and study the default implementations, this
should give
   you a clue how to put it together.
 
   On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott a...@signal11.us
 mailto:a...@signal11.us  wrote: 
 
   I'm using PagedLOD to load terrain tiles off disk. The
problem I have is
   that before I want the tile to actually render, I want
to do a setup of the
   tile (to look up certain control nodes and set switches
according to the
   current state of the system (eg: day/night mode, etc)).
 
   So on my own update(), I check to see if each PagedLOD
has just loaded, and
   if it has, I run the initialization on it. The problem
is, when a tile gets
   loaded, it is rendered for one frame _before_ I can do
my initialization on
   it. So for one frame, it is drawn wrong, then the next
frame, it is drawn
   right.
 
   I thought I might be able to get around this by setting
the Node Mask to 0
   until it was initialized, but that seems to just keep
the tiles from getting
   loaded entirely (because the update traverser isn't
getting into the
   PagedLOD either).
 
   Do any of you have any ideas of what I could try to do
to get around this?
   Is there some value of the NodeMask that I could use to
enable update but
   not draw? Such a value did not seem to be documented in
the API.
-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] frustum culling in shader

2009-04-29 Thread Paul Martz
So you are effectively rendering the sphere in eye coordinates. Have you
tried simply projecting the coordinates (in the vertex shader) onto the far
plane and rendering them there? The coordinates will (of course) need to be
between the near and far plane in order to not be clipped, so just
projecting them into that range (and ideally onto the far plane) should do
the trick.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 

  _  

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Emmanuel
Roche
Sent: Wednesday, April 29, 2009 9:28 AM
To: OSG Users
Subject: [osg-users] frustum culling in shader


Hi everyone,

Just again a simple problem I can't solve myself:

I have an sphere object I want to use as a sky sphere. What's the best wait
to do that ???

The idea I came to is to use a vertex shader to offset each of the sphere
vertex by the current position of the camera in the model frame. But then
nothing is displayed because the moved vertices are behind the near plane
and are culled :-(

Any idea ?

I guess I'm not the first one trying to render a sky sphere any way ??

thanks for your help.

manu.


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


Re: [osg-users] frustum culling in shader

2009-04-29 Thread Jean-Sébastien Guay

Hi Emmanuel,

I have an sphere object I want to use as a sky sphere. What's the best 
wait to do that ???


There's been discussion over the last few days about ways to disable 
auto near/far calculation and override the far plane setting for a 
skydome / sphere. See this thread:


http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/43442

It's a little convoluted but I ended up with something that worked well.

The sphere itself you can do whatever way you want. I prefer to have a 
large sphere that is in the scene (i.e. that doesn't move with the eye 
point) but you may want it to move, in which case I think the easiest 
way is to use a transform that places it in the right place automatically:


class MoveWithCameraTransform : public osg::Transform
{
public:
// Get the transformation matrix which moves from local coords 
to world coords.

virtual bool computeLocalToWorldMatrix(osg::Matrix matrix,
osg::NodeVisitor* nv) const
{
osgUtil::CullVisitor* cv = 
dynamic_castosgUtil::CullVisitor*(nv);

if (cv)
{
osg::Vec3 eyePointLocal = cv-getEyeLocal();
matrix.preMult(osg::Matrix::translate(eyePointLocal));
}

return true;
}

// Get the transformation matrix which moves from world coords 
to local coords.

virtual bool computeWorldToLocalMatrix(osg::Matrix matrix,
osg::NodeVisitor* nv) const
{
osgUtil::CullVisitor* cv = 
dynamic_castosgUtil::CullVisitor*(nv);

if (cv)
{
osg::Vec3 eyePointLocal = cv-getEyeLocal();
matrix.postMult(osg::Matrix::translate(-eyePointLocal));
}

return true;
}
};

If you use this, you don't need to muck around with the auto near/far 
calculation like I did. You can use a sphere of very small size and use 
an osg::Depth that sets fragments only at the far plane, rendering it 
after all other opaque objects have been rendered (but before 
transparent ones so they will be blended with the sky if needed):


// ss is the skydome's stateset.
// Transparent bin is #10 by default so render just before
// transparent objects.
ss-setRenderBinDetails(9, RenderBin);
ss-setAttributeAndModes(
new osg::Depth(osg::Depth::LEQUAL, 1.0, 1.0),
osg::StateAttribute::ON);

Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] unable to glReadPixels in osg::Drawable::drawImplementation

2009-04-29 Thread Can Hosgor
looks like the problem isn't with the code itself, but the scene graph that 
gets rendered before somehow didn't write to the depth buffer.

sorry for bothering you,
can

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





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


Re: [osg-users] osgEarth + OSG 2.8.0 + ATI card

2009-04-29 Thread Jason Beverage
Hi Manu,

Are you using a cache for your .earth files?  If so, try deleting your disk
cache and see if that helps.

Also, what version of osgEarth are you using 1.0 or 1.1?  1.1 added support
for mixing mercator and geodetic sources, which can sometimes result in
non-power-of-two textures being used.  I wonder if perhaps there is an issue
with your card and NPOT.

Thanks,

Jason

On Wed, Apr 29, 2009 at 4:49 AM, Emmanuel Roche roche.emman...@gmail.comwrote:

 Here are a few screen captures...

 Note the half visible groenland on the right side on picture 2 (with part
 of africa on the right :-) ).
 Or the low level Europe map on the left on picture 1.

 The position of the camera is somewhere next to munich in Germany !

 If I don't move the camera the textures eventually change but they are
 replaced by other incorrect textures :-(

 So if you have any idea what I could try here this could be very helpful.

 Manu.





 2009/4/29 Emmanuel Roche roche.emman...@gmail.com

 Hi Jason,

 thanks for your answer. Actually, I just downloaded 2.8.1 rc3, built  it
 and tested my software with those binaries: it solved to problem !!... to
 some extends... :-(

 Actually, i think i'm now facing another ATI specific issue: I can start
 my app, retrieve image and elevation tiles and built my earth model...
 except that after some time (and this is also true if I use an simple
 example like osgviewer yahoo_aerial.earth) it seems that my ATI just start
 mixing all the loaded textures!

 And in fact it seems to be a quite advanced feature as the mixing is
 progressive !!! (ie. We have a nice fading effect when you move slowing !!)

 My guess is, it could be that the graphic card memory is filled with
 textures, and then the ATI driver start using old texture objects
 depending on your distance to your model expecting to create a nice fading
 effect (assuming what we have here are mipmaped textures ?) (except that
 osgEarth keeps updating all the textures any way, so old textures for a
 given area are actually replaced by other textures for other areas). Could
 this make sense ? (or maybe I'm just saying silly things I'm really not an
 expert when it comes to the low level details like that :-) ).

 I'm joining a couple of screen capture in a following mail: maybe someone
 already faced this before.

 Manu.


 2009/4/28 Jason Beverage jasonbever...@gmail.com

 Hi Emmanuel,

 Glad to hear osgEarth is working out for you:)

 Try disabling VBO's by setting the OSG_GL_EXTENSION_DISABLE environment
 variable to GL_ARB_vertex_buffer_object.

 This is really a temporary solution, once 2.8.1 is out the door, you can
 probably just upgrade and it should work fine.

 Thanks!

 Jason

 On Tue, Apr 28, 2009 at 6:12 AM, Emmanuel Roche 
 roche.emman...@gmail.com wrote:

 Hi everyone !

 I've been testing osgEarth for a few days now: it works perfectly on my
 nvidia cards.

 But when trying the same application with an ATI cards, the app just
 shutdowns on some cards, or crashes (with the error mentioned on the
 osgEarth forum here: http://n2.nabble.com/Ati-error-td2603275.html )

 I've read that the rc3 for OSG 2.8.1 comes with a fix item : fixes to
 display lists/vbo creation that prevent crash under ATI drivers. My
 question is : do you know if this is related to the problem I'm 
 experiencing
 currently and has someone already tested osgEarth on a previously crashing
 ATI cards with that version of OSG ?

 best regards,
 Manu.


 ___
 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


[osg-users] Intersection

2009-04-29 Thread Cristina
Hi,

Is there any intersection callback that we can assign to a node, to be able to 
perform intersection with custom render drawables ?

Regards,
Cristina

Thank you.

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





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


Re: [osg-users] Blender/Maya importer

2009-04-29 Thread Alberto Luaces
Hi Meyer,

you could also take the collada route, since OSG dae plugin can write to files 
and Blender has also collada importers.

Regards,

Alberto

El Miércoles 29 Abril 2009ES 15:13:05 Meyer escribió:
 Hi,

 To be honest, I switched from OSG to OGRE some time ago, but hopefully yo
 will forgive me and help me with my problem.

 I need to establish a communication between an OGRE-visualisation and an
 OSG-framework, that produces .ive-files. Is it possible to convert these
 ive-files into ogre .meshes and .materials directly, or at least into a
 file Blender, Maya or 3DStudioMax could read? In your wiki I found a
 Blender exporter, transforming into OSG, but not the other way round. And
 the links to osgmaya (an importer for Maya) and a similar program for 3DS
 didnt work. As Blender is a freeware, it would be really great to be able
 to import and visualize .ive-scenes in it (I could then export it to .mesh
 for OGRE). Does anyone of you know a (working) importer for Blender?

 Thank you a lot!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Intersection

2009-04-29 Thread Alberto Luaces
Hi Cristina,

El Miércoles 29 Abril 2009ES 18:37:16 Cristina escribió:
 Hi,

 Is there any intersection callback that we can assign to a node, to be able
 to perform intersection with custom render drawables ?

You have to subclass your own class for that kind of drawables, since you are 
the only one that knows how they are built.

For example, if I had a custom drawable that drew a sphere, I should subclass 
the intersectionvisitor to take advantage of its equation x^2+y^2+z^2=r^2 
when it arrives to my special drawable.

Regards,

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


Re: [osg-users] Intersection

2009-04-29 Thread Robert Osfield
Hi Cristima,

You'll need to implement the Drawable::accept(PrimtiveFunctor) method
to enable the standard intersection routes etc. to be able to query
your geometry.  Have a look at the Geometry::accept(PrimitiveFunctor)
and ShapeDrawable::accept(PrimitiveFunctor) to how it's done.

Robert.

On Wed, Apr 29, 2009 at 5:37 PM, Cristina cristina.pap...@meggitt.com wrote:
 Hi,

 Is there any intersection callback that we can assign to a node, to be able 
 to perform intersection with custom render drawables ?

 Regards,
 Cristina

 Thank you.

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





 ___
 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] frustum culling in shader

2009-04-29 Thread Emmanuel Roche
Hi Paul,

well, actually, I'm not exactly rendering directly in eye coordinates
(provided I understand what you mean): the sphere should not rotate with the
camera (in fact I'm not rendering a sphere: rather points representing stars
by the way).

But your idea is very good: until now, I was using something like:

 gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix *
myModifiedVertexPos;

== I'm computing the modified vertex position by offseting the gl_Vertex by
the camera position in the model frame.

Now that you mention it I realize my error must come from the usage of the
gl_ProjectionMatrix which is the latest projection matrix computed by OSG
(using the initial sphere vertices).

I'm not familiar at all with projection matrices computation, but I will
give it a try tomorrow  :-).

thanks for your help.
Manu.


2009/4/29 Paul Martz pma...@skew-matrix.com

  So you are effectively rendering the sphere in eye coordinates. Have you
 tried simply projecting the coordinates (in the vertex shader) onto the far
 plane and rendering them there? The coordinates will (of course) need to be
 between the near and far plane in order to not be clipped, so just
 projecting them into that range (and ideally onto the far plane) should do
 the trick.

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


  --
 *From:* osg-users-boun...@lists.openscenegraph.org [mailto:
 osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *Emmanuel Roche
 *Sent:* Wednesday, April 29, 2009 9:28 AM
 *To:* OSG Users
 *Subject:* [osg-users] frustum culling in shader

 Hi everyone,

 Just again a simple problem I can't solve myself:

 I have an sphere object I want to use as a sky sphere. What's the best wait
 to do that ???

 The idea I came to is to use a vertex shader to offset each of the sphere
 vertex by the current position of the camera in the model frame. But then
 nothing is displayed because the moved vertices are behind the near plane
 and are culled :-(

 Any idea ?

 I guess I'm not the first one trying to render a sky sphere any way ??

 thanks for your help.

 manu.


 ___
 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] PagedLOD

2009-04-29 Thread Alan Ott

Thrall, Bryan wrote:


Alan Ott wrote on Tuesday, April 28, 2009 10:34 AM:
 


Thanks for the info. From this, it seems like I can get a handle to
   


the newly
 


loaded node before it gets added to the main tree. The only thing now
   


is that
 


once I've got a handle to this node, I don't really know _what_ the
   


node is
 

supposed to be (is it a terrain tile, a moving model? etc.).   


ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it
   


seems
 


like I could make a new option string telling me how to post-process
   


this
 


model load, but I can't see how in PagedLOD to set
   

ReaderWriterOptions.  


Unfortunately, at the moment PagedLOD doesn't have a way to specify
ReaderWriterOptions (and adding that ability is a little complicated,
because we don't want a circular dependency between osg and osgDB).

One thing you can do is subclass PagedLOD in your app to add the ability
to specify a ReaderWriterOptions when it calls readNode().

 


PagedLOD has the setDatabaseRequest() function, which based on another
mailing list post, looks like it is to be used as a user data
   


pointer. The
 


problem here is that I don't know how to get this object from inside
   


the
 

ReadFileCallback.   
   



This makes me think you're using an older version of OSG? The latest OSG
in svn only has getDatabaseRequest() (which you can use to set the
DatabaseRequest). In any case, the database request isn't really for
user data; it is specifically for osgDB::DatabasePager use.

 


Robert Osfield wrote:
As Bryan wrote, what you need is to write a custom
osgDB::Registry::ReadFileCallback that will intercept all DB
   


calls,
 


you then leave it up to Registry itself to the do the reading
   


from the
 


plugin, but then you process the loaded data before passing the
   


end
 


result back from the callback.  Have a look at the
   


ReadFileCallback
 


implementation and study the default implementations, this
   


should give
 


you a clue how to put it together.

On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott a...@signal11.us
mailto:a...@signal11.us  wrote: 


I'm using PagedLOD to load terrain tiles off disk. The
   


problem I have is
 


that before I want the tile to actually render, I want
   


to do a setup of the
 


tile (to look up certain control nodes and set switches
   


according to the
 


current state of the system (eg: day/night mode, etc)).

So on my own update(), I check to see if each PagedLOD
   


has just loaded, and
 


if it has, I run the initialization on it. The problem
   


is, when a tile gets
 


loaded, it is rendered for one frame _before_ I can do
   


my initialization on
 


it. So for one frame, it is drawn wrong, then the next
   


frame, it is drawn
 


right.

I thought I might be able to get around this by setting
   


the Node Mask to 0
 


until it was initialized, but that seems to just keep
   


the tiles from getting
 


loaded entirely (because the update traverser isn't
   


getting into the
 


PagedLOD either).

Do any of you have any ideas of what I could try to do
   


to get around this?
 


Is there some value of the NodeMask that I could use to
   


enable update but
 


not draw? Such a value did not seem to be documented in
   


the API.
 



Bryan,

You are right. I didn't read closely enough, and there is no 
setDatabaesRequest(). I am using OSG 2.6. You had a good idea with the 
subclassing of PagedLOD and the options, but what I ended up doing was I 
think simpler. I subclassed PagedLOD and overrode the addChild() method, 
calling my init function from the override. This way I could have all 
the user data I want (with pointers to my own objects), which would 
not have been possible from the callback.


Thanks for your help,

Alan.

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


Re: [osg-users] PagedLOD

2009-04-29 Thread Thrall, Bryan
Alan Ott wrote on Wednesday, April 29, 2009 3:22 PM:
 You are right. I didn't read closely enough, and there is no
 setDatabaesRequest(). I am using OSG 2.6. You had a good idea with the
 subclassing of PagedLOD and the options, but what I ended up doing was
I
 think simpler. I subclassed PagedLOD and overrode the addChild()
method,
 calling my init function from the override. This way I could have all
the
 user data I want (with pointers to my own objects), which would not
have
 been possible from the callback.  
 
 Thanks for your help,

Yes, that works, too :)

Glad I could help,
-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD

2009-04-29 Thread Alan Ott

Jakob,

Thanks for the idea. What I ended up doing was subclassing PagedLOD and 
overriding the addChild() method and doing the init from my overridden 
method. This way, I could have pointers to my own objects, which were 
necessary for the initialization.


Thanks for your help,

Alan.

Jakob Ruhe wrote:


I think you can solve what you want by making sure your own pseudo
loader is used instead. You do this by adding some extension
(.ott_terrain, .ott_model, ...) to the filenames of the children of
your PagedLODs and you register a ReaderWriter that supports those
extensions. You can then in your ReaderWriter remove the extension and
load the real file with the right loader by calling
osgDB::readNodeFile as usual and then do the postprocessing of the
node. Note that all this will be done in a thread created by
DatabasePager. If you need to do some postprocessing in your main
scenegraph thread you can add a callback (update callback or cull
callback) to the node.

If you need an example how this can be done please have a look at osgEarth.

Good luck!

/Jakob Ruhe

2009/4/28 Alan Ott a...@signal11.us:
 


Robert and Bryan,

Thanks for the info. From this, it seems like I can get a handle to the
newly loaded node before it gets added to the main tree. The only thing now
is that once I've got a handle to this node, I don't really know _what_ the
node is supposed to be (is it a terrain tile, a moving model? etc.).

ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it seems
like I could make a new option string telling me how to post-process this
model load, but I can't see how in PagedLOD to set ReaderWriterOptions.

PagedLOD has the setDatabaseRequest() function, which based on another
mailing list post, looks like it is to be used as a user data pointer. The
problem here is that I don't know how to get this object from inside the
ReadFileCallback.

I simply need to tag each request (made by the PagedLOD) as terrain or
model so that I know specifically what initialization to do in the
ReadFileCallback.

Am I missing something obvious here?

Thanks for your help,

Alan.


Robert Osfield wrote:

Hi Alan,

As Bryan wrote, what you need is to write a custom
osgDB::Registry::ReadFileCallback that will intercept all DB calls,
you then leave it up to Registry itself to the do the reading from the
plugin, but then you process the loaded data before passing the end
result back from the callback.  Have a look at the ReadFileCallback
implementation and study the default implementations, this should give
you a clue how to put it together.

Robert.

On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott a...@signal11.us wrote:


Hello,

I'm using PagedLOD to load terrain tiles off disk. The problem I have is
that before I want the tile to actually render, I want to do a setup of the
tile (to look up certain control nodes and set switches according to the
current state of the system (eg: day/night mode, etc)).

So on my own update(), I check to see if each PagedLOD has just loaded, and
if it has, I run the initialization on it. The problem is, when a tile gets
loaded, it is rendered for one frame _before_ I can do my initialization on
it. So for one frame, it is drawn wrong, then the next frame, it is drawn
right.

I thought I might be able to get around this by setting the Node Mask to 0
until it was initialized, but that seems to just keep the tiles from getting
loaded entirely (because the update traverser isn't getting into the
PagedLOD either).

Do any of you have any ideas of what I could try to do to get around this?
Is there some value of the NodeMask that I could use to enable update but
not draw? Such a value did not seem to be documented in the API.

Thanks for all your help,

Alan.


___
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

 



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


Re: [osg-users] frustum culling in shader

2009-04-29 Thread Emmanuel Roche
Hi again!

Sébastien, I'm afraid I cannot use the transform you're suggesting: in fact
I should not rely at all on the camera position, because the cam position
may also depends on moving objects in my scene and the cam position is
updated during the event traversal.

So I would update the position with the current cam pos,
Then update the cam pos with another objet position
and then render the scene

== This leads to improper rendering (specially when your targeted objects
are moving very fast) [and I'm rendering a solar system where I use meters
as the base unit  :-)]

regards,
Manu.


2009/4/29 Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com

 Hi Emmanuel,

  I have an sphere object I want to use as a sky sphere. What's the best
 wait to do that ???


 There's been discussion over the last few days about ways to disable auto
 near/far calculation and override the far plane setting for a skydome /
 sphere. See this thread:

 http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/43442

 It's a little convoluted but I ended up with something that worked well.

 The sphere itself you can do whatever way you want. I prefer to have a
 large sphere that is in the scene (i.e. that doesn't move with the eye
 point) but you may want it to move, in which case I think the easiest way is
 to use a transform that places it in the right place automatically:

 class MoveWithCameraTransform : public osg::Transform
 {
public:
// Get the transformation matrix which moves from local coords to
 world coords.
virtual bool computeLocalToWorldMatrix(osg::Matrix matrix,
osg::NodeVisitor* nv) const
{
osgUtil::CullVisitor* cv =
 dynamic_castosgUtil::CullVisitor*(nv);
if (cv)
{
osg::Vec3 eyePointLocal = cv-getEyeLocal();
matrix.preMult(osg::Matrix::translate(eyePointLocal));
}

return true;
}

// Get the transformation matrix which moves from world coords to
 local coords.
virtual bool computeWorldToLocalMatrix(osg::Matrix matrix,
osg::NodeVisitor* nv) const
{
osgUtil::CullVisitor* cv =
 dynamic_castosgUtil::CullVisitor*(nv);
if (cv)
{
osg::Vec3 eyePointLocal = cv-getEyeLocal();
matrix.postMult(osg::Matrix::translate(-eyePointLocal));
}

return true;
}
 };

 If you use this, you don't need to muck around with the auto near/far
 calculation like I did. You can use a sphere of very small size and use an
 osg::Depth that sets fragments only at the far plane, rendering it after all
 other opaque objects have been rendered (but before transparent ones so they
 will be blended with the sky if needed):

// ss is the skydome's stateset.
// Transparent bin is #10 by default so render just before
// transparent objects.
ss-setRenderBinDetails(9, RenderBin);
ss-setAttributeAndModes(
new osg::Depth(osg::Depth::LEQUAL, 1.0, 1.0),
osg::StateAttribute::ON);

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.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] ViewDependentShadow and Lod

2009-04-29 Thread Wojciech Lewandowski
Hi Antonin,

As far as I remember, ABSOLUTE_RF_INHERIT_VIEWPOINT reference frame for Shadow 
map camera is  set in osgShadow::StandardShadowMap and should be inherited and 
used by all derived classes including DebugShadowMap, MinimalCull/DrawBounds 
and all three LispSM flavours. So it looks like your problems may be caused by 
something else...

We have been using LispSM with LODs and we have not seen major artifacts since 
this addition of ABSOLUTE_RF_INHERIT_VIEWPOINT which happened after discussion 
you referenced. 

Maybe you are using LODs switched by pixel sizes (not viewpoint distance ) ? I 
have not tested this scenario but I would guess that it would depend on shadow 
map resolution. Its also possible that LispSM skewed projection matrix may 
somehow cause wrong results in pixel size LOD computations. 

Sorry to say that but you caught me at bad moment. I am going on a 5 day trip 
tomorrow and will be offline till next Tuesday.  If you are unable  to solve 
the issue by then, send some more info and maybe we would come up with some 
fresh idea...

Cheers,
Wojtek Lewandowski



From: Antonin Linares 
Sent: Wednesday, April 29, 2009 5:57 PM
To: osg osg 
Subject: [osg-users] ViewDependentShadow and Lod


Hi all,

I actualy use LightSpacePerspectiveShadowMap and it's work very well.
but :(
My terrain database lod levels became crazy, he seem to me it's the same 
problem in this thread here. (lod is compute from the shadow camera view point
 instead of eyes points)
So i test to change the shadow camera RefernceFrame to 
ABSOLUTE_RF_INHERIT_VIEWPOINT
in DebugShadowMap but it's made no change.

Wojtek save me !! 
thanks all.

Antonin Linares.








___
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] osgEarth + OSG 2.8.0 + ATI card

2009-04-29 Thread Carlos Sanches
hi !
I was running osgearth here but the texture arent so close like your
pictures .
How can I get the best textures ??
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgEarth + OSG 2.8.0 + ATI card

2009-04-29 Thread Jason Beverage

Hi Carlos

Higher resolution imagery loads in as you zoom in closer to the  
ground. Are you any issues in particular?


Jason

On Apr 29, 2009, at 6:31 PM, Carlos Sanches ces...@gmail.com wrote:


hi !
I was running osgearth here but the texture arent so close like your  
pictures .

How can I get the best textures ??


___
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] how to specify GLSL attribute??

2009-04-29 Thread Brett
Hi,

Im new to osg.I want to  use an attribute float vertextemp; in my vertex 
shader.How to 
give that array to vertex shader.

Thank you.

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





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


Re: [osg-users] how to specify GLSL attribute??

2009-04-29 Thread Paul Martz
To do what you want, use a Uniform. Try doing a case insensitive grep in the
OSG source and examples for the word uniform for more info.

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

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Brett
Sent: Wednesday, April 29, 2009 5:09 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] how to specify GLSL attribute??

Hi,

Im new to osg.I want to  use an attribute float vertextemp; in my vertex
shader.How to give that array to vertex shader.

Thank you.

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





___
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] how to specify GLSL attribute??

2009-04-29 Thread Jason Daly

Brett wrote:

Hi,

Im new to osg.I want to  use an attribute float vertextemp; in my vertex shader.How to 
give that array to vertex shader.
  


Assuming you have an osg::Geometry object called geometry, and an 
osg::Program called program, the following code should work:



osg::FloatArray * attrib = new osg::FloatArray();

// (Fill attrib with per-vertex attributes)

int attrNum = 1;
geometry-setVertexAttribArray(attrNum, attrib);
geometry-setVertexAttribBinding(attrNum, osg::Geometry::BIND_PER_VERTEX);

program-addBindAttribLocation(vertextemp, attrNum);


You can set attrNum to any vertex attribute location that's not 
currently in use.  I'd avoid 0, 2, 3, or 8, because certain video 
drivers may still alias the generic vertex attributes with the 
traditional ones (vertex coordinates are at 0, normals at 2, colors at 
3, texture coordinates at 8).


--J

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


Re: [osg-users] how to specify GLSL attribute??

2009-04-29 Thread Paul Martz
Ah yes. Vertex attributes. My mistake, that's what I get for speed reading.

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

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jason Daly
Sent: Wednesday, April 29, 2009 7:21 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] how to specify GLSL attribute??

Brett wrote:
 Hi,

 Im new to osg.I want to  use an attribute float vertextemp; in my 
 vertex shader.How to give that array to vertex shader.
   

Assuming you have an osg::Geometry object called geometry, and an
osg::Program called program, the following code should work:


osg::FloatArray * attrib = new osg::FloatArray();

// (Fill attrib with per-vertex attributes)

int attrNum = 1;
geometry-setVertexAttribArray(attrNum, attrib);
geometry-setVertexAttribBinding(attrNum, osg::Geometry::BIND_PER_VERTEX);

program-addBindAttribLocation(vertextemp, attrNum);


You can set attrNum to any vertex attribute location that's not 
currently in use.  I'd avoid 0, 2, 3, or 8, because certain video 
drivers may still alias the generic vertex attributes with the 
traditional ones (vertex coordinates are at 0, normals at 2, colors at 
3, texture coordinates at 8).

--J

___
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