Re: [osg-users] vertex shaders

2007-05-12 Thread Mike Weiblen
Hi,

there are a couple examples using vertex attributes in osgToy, see
compactdisc.osg and compactdisc-texcoord.osg at
http://osgtoy.cvs.sourceforge.net/osgtoy/osgtoy/osgtoy-data/
The former uses a GLSL generic attribute, the latter uses a predefined GLSL
texcoord.

those example only have a vertex shader, using the default fixed function
pipeline for the fragment processing.

cheers
-- mew



Wasileski, Bryan J. wrote:
> Hi all,
>  
> I'm looking for some advice on implementing a vertex shader for surface
> geometry being creating in OSG.
>  
> I have a surface consisting of triangular strips (and other
> primitives) which are created using arrays of vertices and indices. For
> each vertex, I'd like to assign an attribute which I can access within
> the shader. Normally, this is done by creating and assigning the vertex
> attribute between the glBegin() / glEnd() for each vertex in the
> geometry. Since OSG abstracts away the glBegin, glEnd, etc.,  how do I
> define the attributes of the vertices?  Modify the source? Straight OpenGL?
>  
> Thanks in advance.
>  
> Bryan

-- 
Mike Weiblen -- Austin Texas USA -- http://mew.cx/

___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


RE: [osg-users] trouble compiling 'simple' app from osg quick start guide - no osgViewer

2007-05-12 Thread Paul Martz

> Okay so I downloaded the most recent version 1.9.3 and had a 
> little more luck, but now when I build the project I get an error
> 
> LINK : fatal error LNK1104: cannot open file 'osgTextd.lib'

When Robert releases OSG as a "final" 2.0, there will be precompiled
binaries available for many platforms, just like it says in the Quick Start
Guide. In the meantime, you'll need to build the 1.9.3 OSG binaries from the
OSG source that you downloaded.
   -Paul

___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


Re: [osg-users] Re: Collision in osg

2007-05-12 Thread Anders Backman

The bounding sphere of a node is actually generated from a a bounding
box surrounding the  Drawable (geometry) leaf. This makes the bounding
sphere a crude approximation of the real size of your sphere.

Therefore I would recommend a parallel structure for doing collision detection.
Depending on the number of collisions, and what information you need
(boolean query/ penetration, normal) there are quite a few different
ways to go around this.

If you only need boolean query (intersection yes/no) and you have lots
of spheres of similar sizes, then a spatial hash is a good
alternative. Its very fast for this thing, you can have 100.000:s of
thousands and still get good performance unless you have them
occupying the same space.

Other efficient datastructures/algorithms are octrees, KD-trees,
sphere-trees, Separating Axis test, ...

It all depends on what scalability you require from your app.
There are quite a few libs that does very efficient collision detection.
Osg is mostly for rendering, and ray/scene intersection tests,
anything beyond that you have to add yourself...
There are quite a few approaches to add ODE for collision
detection/dynamics Look at the osgwiki for Don Burns osg/ode
example.

/Anders



On 5/11/07, Rémi Chaignon <[EMAIL PROTECTED]> wrote:

Hi all again, (sorry I pressed the wrong button)


In my program, I am creating 2 spheres in the same way:


// Create a sphere centered at the origin, unit radius:
osg::Sphere* sphere = new osg::Sphere(osg::Vec3f( 0.f, 0.f, 0.f),
1.f);

osg::ShapeDrawable* sphereDrawable = new osg::ShapeDrawable(sphere);
sphereDrawable->setColor(osg::Vec4f(0.4f, 0.2f,
0.8f, 1.f));


osg::Geode* sphereGeode = new osg::Geode();
sphereGeode->addDrawable(sphereDrawable);

osg::MatrixTransform* sphereTransform = new osg::MatrixTransform();
sphereTransform->addChild(sphereGeode);

return sphereTransform;


Then I want to know if the spheres collide, to do this, I've tried different
ways:
   - Get the bounding sphere of the node (getBound())
 Result: A collision is detected even when the spheres are far from
each other.

   - Get the bounding sphere of the geode (getBound())
   - Get the bounding box of the geode (getBoundingBox())
   - Get the bounding box of the drawable (getBound())
  Result: A collision is always detected.

Debugging, I've found that the bounding box never moves and always remains
the same (eg [-1, 1] on each axis). So I've tried to apply the different
transformations to the bounding box but it didn't work either.

I am new at OpenSceneGraph, so I'm definitely doing something wrong there
but I don't know what.

Can someone help me, please.

Thank you,

Rémi.



___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/




--



Anders Backman   Email:[EMAIL PROTECTED]
HPC2N/VRlab  Phone:+46 (0)90-786 9936
Umea university  Cellular: +46 (0)70-392 64 67
S-901 87 UMEA SWEDEN Fax:  +46 90-786 6126
  http://www.cs.umu.se/~andersb
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


[osg-users] Database pager and osgViewer

2007-05-12 Thread Serge Lages

Hi,

I would like to know if it's normal that the registry and the viewer have
different instances of the database pager ? With osgProducer they share the
same, and it was usefull to be able to retrieve the pager anywhere with
osgDB::Registry::instance()->getDatabasePager(). In my app I use it to
register custom PagedLOD, but it registers it to the registry pager, which
is not used by the viewer, so nothing is deleted... :/

Thanks in advance !

--
Serge Lages
http://www.magrathea-engine.org
___
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/