Re: [osg-users] Few things

2007-07-05 Thread Robert Osfield

On 7/5/07, amalric alexandre <[EMAIL PROTECTED]> wrote:

Hi osg user,

I would like to know if there is a way to use the functionnality of .logo
reader with osg 2.0, because it doesn't work anymore. It was a really
important tool for my application.
Have someone an idea or a answer to this problem ?


I spent a couple of hours trying to debug the logo plugin, it gets
called correctly, the code looks correct, albeit a bit esoteric.  It
should work, it just doesn't display anything :-|

The fallback I'd use would be to just use a slave camera, attached to
your viewer, that does the HUD to display the label.

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


Re: [osg-users] Few things

2007-07-05 Thread amalric alexandre

Hi osg user,

I would like to know if there is a way to use the functionnality of .logo
reader with osg 2.0, because it doesn't work anymore. It was a really
important tool for my application.
Have someone an idea or a answer to this problem ?

Thanks,


2007/6/14, Anders Backman <[EMAIL PROTECTED]>:


sure, its not a critical thing.

/Anders


On 6/14/07, Robert Osfield <[EMAIL PROTECTED]> wrote:
> On 6/7/07, Robert Osfield <[EMAIL PROTECTED]> wrote:
> > On 6/7/07, Anders Backman <[EMAIL PROTECTED]> wrote:
> > > A few things:
> > >
> > > 1. The logo reader seems to have stopped working?
> > >
> > > osgviewer osg64.logo shows nothing on my version of osg. (svn
checkout
> > > at 23:rd of june).
> > > Has there been any recent changes in the reader, because it worked
> > > some while back...
> >
> > Could you provide osg64.logo, I don't have it on my system.  I also
> > haven't used the logo plugin after a bit of brief testing a few years
> > back... So.. I wouldn't know about any issues with it...
>
> I tracked down the osg64.logo, it twas missing from my new SVN version
> of OpenSceneGraph-Data for a little while... Its now there.
>
> But... it doesn't render when loaded ;-|
>
> I've done some debugging on the plugin and everything looks OK, but I
> still can't get it to render anything.  I tried osgproducerviewer just
> in case it did something different than osgviewer but alas no luck
> there either.  I don't know when the logo plugin broke as its not
> something I've ever used.  I'm basically stumped on this one.
>
> Perhaps reimplementing the logo plugin using a standard OSG components
> rather than extended Drawable might provide a different point to test
> from.  This doesn't change the fact that what is there looks like it
> should work.  My best guess is that there is something missing in set
> up of OpenGL state, but what this might be I don't have clue, I tried
> all the obvious things.
>
> I'm afraid this item is something that will have to wait to post 2.0.
>
> Robert.
> ___
> 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 mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Re: [osg-users] Few things

2007-06-14 Thread Anders Backman

sure, its not a critical thing.

/Anders


On 6/14/07, Robert Osfield <[EMAIL PROTECTED]> wrote:

On 6/7/07, Robert Osfield <[EMAIL PROTECTED]> wrote:
> On 6/7/07, Anders Backman <[EMAIL PROTECTED]> wrote:
> > A few things:
> >
> > 1. The logo reader seems to have stopped working?
> >
> > osgviewer osg64.logo shows nothing on my version of osg. (svn checkout
> > at 23:rd of june).
> > Has there been any recent changes in the reader, because it worked
> > some while back...
>
> Could you provide osg64.logo, I don't have it on my system.  I also
> haven't used the logo plugin after a bit of brief testing a few years
> back... So.. I wouldn't know about any issues with it...

I tracked down the osg64.logo, it twas missing from my new SVN version
of OpenSceneGraph-Data for a little while... Its now there.

But... it doesn't render when loaded ;-|

I've done some debugging on the plugin and everything looks OK, but I
still can't get it to render anything.  I tried osgproducerviewer just
in case it did something different than osgviewer but alas no luck
there either.  I don't know when the logo plugin broke as its not
something I've ever used.  I'm basically stumped on this one.

Perhaps reimplementing the logo plugin using a standard OSG components
rather than extended Drawable might provide a different point to test
from.  This doesn't change the fact that what is there looks like it
should work.  My best guess is that there is something missing in set
up of OpenGL state, but what this might be I don't have clue, I tried
all the obvious things.

I'm afraid this item is something that will have to wait to post 2.0.

Robert.
___
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/


Re: [osg-users] Few things

2007-06-14 Thread Robert Osfield

On 6/7/07, Robert Osfield <[EMAIL PROTECTED]> wrote:

On 6/7/07, Anders Backman <[EMAIL PROTECTED]> wrote:
> A few things:
>
> 1. The logo reader seems to have stopped working?
>
> osgviewer osg64.logo shows nothing on my version of osg. (svn checkout
> at 23:rd of june).
> Has there been any recent changes in the reader, because it worked
> some while back...

Could you provide osg64.logo, I don't have it on my system.  I also
haven't used the logo plugin after a bit of brief testing a few years
back... So.. I wouldn't know about any issues with it...


I tracked down the osg64.logo, it twas missing from my new SVN version
of OpenSceneGraph-Data for a little while... Its now there.

But... it doesn't render when loaded ;-|

I've done some debugging on the plugin and everything looks OK, but I
still can't get it to render anything.  I tried osgproducerviewer just
in case it did something different than osgviewer but alas no luck
there either.  I don't know when the logo plugin broke as its not
something I've ever used.  I'm basically stumped on this one.

Perhaps reimplementing the logo plugin using a standard OSG components
rather than extended Drawable might provide a different point to test
from.  This doesn't change the fact that what is there looks like it
should work.  My best guess is that there is something missing in set
up of OpenGL state, but what this might be I don't have clue, I tried
all the obvious things.

I'm afraid this item is something that will have to wait to post 2.0.

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


Re: [osg-users] Few things

2007-06-07 Thread Robert Osfield

On 6/7/07, Anders Backman <[EMAIL PROTECTED]> wrote:

A few things:

1. The logo reader seems to have stopped working?

osgviewer osg64.logo shows nothing on my version of osg. (svn checkout
at 23:rd of june).
Has there been any recent changes in the reader, because it worked
some while back...


Could you provide osg64.logo, I don't have it on my system.  I also
haven't used the logo plugin after a bit of brief testing a few years
back... So.. I wouldn't know about any issues with it...


 2. Next thing: A fairly easy (unsure about its actual speedup though)
optimization for one specific file is toremove the numerous /V.x() in
the TangentSpaceGenerator.cpp.
Nevertheless, using the same divisor numerous time is not recomended


Wow overload.  I'm in getting a release out mode, not in spend lots of
time thinking about optimizing different parts of the OSG.  If you can
spot an optimization then you're welcome to mod the code and submit
it.

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


[osg-users] Few things

2007-06-07 Thread Anders Backman

Hi all (Robert)

A few things:

1. The logo reader seems to have stopped working?

osgviewer osg64.logo shows nothing on my version of osg. (svn checkout
at 23:rd of june).
Has there been any recent changes in the reader, because it worked
some while back...

2. Next thing: A fairly easy (unsure about its actual speedup though)
optimization for one specific file is toremove the numerous /V.x() in
the TangentSpaceGenerator.cpp.
Nevertheless, using the same divisor numerous time is not recomended

Also, I was thinking, if you only need the Tangent (the normal is
usually already known) there could be some gain in not computing all
of the elements?
Usually calculating the Bi-Tangent in a shader is faster than
calculating it on the CPU and then sending it over to the GPU. So I
guess there could be an option on what to actually calculate.
But I also noticed that all of them seems to be necessary for the
calculation in the current implementation.

In an ideal world only the Tangent needs to be calculated (using the
existing Normal), right?
That would really speed things up.
But thats for the future :-)



#include 

#include 
#include 

using namespace osgUtil;

TangentSpaceGenerator::TangentSpaceGenerator()
:osg::Referenced(),
   T_(new osg::Vec4Array),
   B_(new osg::Vec4Array),
   N_(new osg::Vec4Array)
{
}

TangentSpaceGenerator::TangentSpaceGenerator(const
TangentSpaceGenerator ©, const osg::CopyOp ©op)
:osg::Referenced(copy),
   T_(static_cast(copyop(copy.T_.get(,
   B_(static_cast(copyop(copy.B_.get(,
   N_(static_cast(copyop(copy.N_.get(
{
}

void TangentSpaceGenerator::generate(osg::Geometry *geo, int
normal_map_tex_unit)
{
   // check to see if vertex attributes indices exists, if so expand
them to remove them
   if (geo->suitableForOptimization())
   {
   // removing coord indices so we don't have to deal with them
in the binormal code.
   osg::notify(osg::INFO)<<"TangentSpaceGenerator::generate(Geometry*,int):
Removing attribute indices"getVertexArray();
   const osg::Array *nx = geo->getNormalArray();
   const osg::Array *tx = geo->getTexCoordArray(normal_map_tex_unit);

   if (!vx || !tx) return;


   unsigned int vertex_count = vx->getNumElements();
   if (geo->getVertexIndices() == NULL) {
   T_->assign(vertex_count, osg::Vec4());
   B_->assign(vertex_count, osg::Vec4());
   N_->assign(vertex_count, osg::Vec4());
   } else {
   unsigned int index_count = geo->getVertexIndices()->getNumElements();
   T_->assign(index_count, osg::Vec4());
   B_->assign(index_count, osg::Vec4());
   N_->assign(index_count, osg::Vec4());
   indices_ = new osg::UIntArray();
   unsigned int i;
   for (i=0;ipush_back(i);
   }
   }

   unsigned int i; // VC6 doesn't like for-scoped variables

   for (unsigned int pri=0; prigetNumPrimitiveSets(); ++pri) {
   osg::PrimitiveSet *pset = geo->getPrimitiveSet(pri);

   unsigned int N = pset->getNumIndices();

   switch (pset->getMode()) {

   case osg::PrimitiveSet::TRIANGLES:
   for (i=0; igetType() ==
osg::PrimitiveSet::DrawArrayLengthsPrimitiveType) {
   osg::DrawArrayLengths *dal =
static_cast(pset);
   unsigned int j = 0;
   for (osg::DrawArrayLengths::const_iterator
pi=dal->begin(); pi!=dal->end(); ++pi) {
   unsigned int iN = static_cast(*pi-2);
   for (i=0; igetType() ==
osg::PrimitiveSet::DrawArrayLengthsPrimitiveType) {
   osg::DrawArrayLengths *dal =
static_cast(pset);
   unsigned int j = 0;
   for (osg::DrawArrayLengths::const_iterator
pi=dal->begin(); pi!=dal->end(); ++pi) {
   unsigned int iN = static_cast(*pi-2);
   for (i=0; igetMode() <<
"\n";
   }
   }

   // normalize basis vectors and force the normal vector to match
   // the triangle normal's direction
   unsigned int attrib_count = vx->getNumElements();
   if (geo->getVertexIndices() != NULL) {
   attrib_count = geo->getVertexIndices()->getNumElements();
   }
   for (i=0; i= 0) {
   vN = osg::Vec4(txN, 0);
   } else {
   vN = osg::Vec4(-txN, 0);
   }

   vT.normalize();
   vB.normalize();
   vN.normalize();
   }
   /* TO-DO: if indexed, compress the attributes to have only one
* version of each (different indices for each one?) */
}

void TangentSpaceGenerator::compute(osg::PrimitiveSet *pset,
   const osg::Array* vx,
   const osg::Array* nx,
   const osg::Array* tx,
   int iA, int iB, int iC)
{
   iA = pset->index(iA);
   iB = pset->index(iB);
   iC = pset->index(iC);

   osg::Vec3 P1;
   osg::Vec3 P2;
   osg::Vec3 P3;

   int i; // VC6 doesn't like for-scoped variables

   switch (vx->getT