Re: [osg-users] Getting world coord bounding box

2007-12-02 Thread Siddharth Palaniappan

Hi Daniel,

I tried out a seperate code example and it did work. But i couldnt get
 it working for my project. Like i previously mentioned i needed to get
 the world coordinates of the boundingboxes of the loaded openflight
 models and if the bounding boxes intersected , i wanted to stop the
 vehicle on the animation path. The world coordinates matrix that i receive
 each time, seems to be correct as i checked the position of the
 ControlPointMap by using the write() in the AnimationPath class. I am now 
trying
 to manually get the worldcoordinates and keep altering a geode and
 attach it to the root node to see if the transformation made to the local
 coordinates do infact match. 

Is there any code snippet around that tells how to get the world
 coordinates  for a model on an  AnimationPath? To get the world coordinates
 this is what i did - 

class getWorldCoordOfNodeVisitor : public osg::NodeVisitor 
{
public:
   getWorldCoordOfNodeVisitor():
  osg::NodeVisitor(NodeVisitor::TRAVERSE_PARENTS), done(false)
  {
 wcMatrix= new osg::Matrixd() ;
  }
  virtual void apply(osg::Node node)
  {
 if (!done)
 {
if ( 0 == node.getNumParents() ) // no parents
{
   wcMatrix-set(
 osg::computeLocalToWorld(this-getNodePath()) ) ;
   done = true ;
}
traverse(node) ;
 }
  }
  osg::Matrixd* giveUpDaMat() 
  {
 return wcMatrix ;
  }
private:
   bool done ;
   osg::Matrix* wcMatrix ;
} ;

osg::Matrixd* getWorldCoords( osg::Node* node) 
{
   getWorldCoordOfNodeVisitor* ncv = new getWorldCoordOfNodeVisitor() ;
   if (node  ncv)
   {
  node-accept(*ncv) ;
  return ncv-giveUpDaMat() ;
   }
   else
   {
  return NULL ;
   }
} 

I have two MatrixTransform node above my vehicle model node. And i use
 this to get the World Coord transfomation matrix. The first/topmost
 transformation node is a static node to set the initial position and its
 child node is another transformation matrix which has an
 AnimationPathCallback set to(which moves the vehicle on a spline). 

I also see that the animationpathcallback has an update function. Now , does 
the animationpathcallback automatically update my TransformMatrix to which i 
have set this as a callback?

Do you think the workflow is correct? Am i missing anything? ANy
 suggestions?

Thanks for your help...

Siddharth



- Original Message 
From: Siddharth Palaniappan [EMAIL PROTECTED]
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Sent: Saturday, December 1, 2007 2:56:27 PM
Subject: Re: [osg-users] Getting world coord bounding box


Hi daniel,

Yes thats a good idea..I will definitely try that and let you know how
 it works out. Thank you.

Siddharth


- Original Message 
From: Daniel Holz [EMAIL PROTECTED]
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Sent: Saturday, December 1, 2007 2:50:11 PM
Subject: Re: [osg-users] Getting world coord bounding box


hi siddharth,

i just started being confused reading the link you sent me when i got 
this new email of yours :)
if i am in a situation like this what i usually do is i draw what i 
can't see. in your case it is the bounding box PRIOR to your 
transformation to world coordinates and the one AFTER transforming.
 just 
render to boxes or render spheres in two different colors marking the 
positions of the corners.
i am sure, having something visually, you will be able to figure out
 the 
problem.

cheers,
daniel

Siddharth Palaniappan wrote:
 Hi Daniel,

 Sorry for the misunderstanding...yes you're right, it has to be done
 on the left side. But i still dont get any valid results. Can you
 suggest how i can test if the world coordinates of the box after
 multiplication is correct or not?

 Thank you,

 Siddharth

 - Original Message 
 From: Siddharth Palaniappan [EMAIL PROTECTED]
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Saturday, December 1, 2007 2:41:19 PM
 Subject: Re: [osg-users] Getting world coord bounding box


 Hi daniel,

 I read thru this at the osg site :



 
http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations

 In the end , robert says ways are defined ... i initially multiplied
  the matrix on the left side. But after reading this i changed
 it...am i
  wrong ?

 Siddharth

 - Original Message 
 From: Daniel Holz [EMAIL PROTECTED]
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Saturday, December 1, 2007 2:35:52 PM
 Subject: Re: [osg-users] Getting world coord bounding box


 hi,

 don't you have to multiply the matrix from the left side with the 
 vector, like this:
 M * x = x',
 whereas M is your 'WorldCoordsMatrix', x is your local BBox vector
 and 
 x' is the same in world coords.

 hope this helps.

 daniel

 Siddharth Palaniappan wrote:
   
 Hi osg users,

 I'm currently using openscenegraph for my class project to simulate

Re: [osg-users] FBO resizing problem

2007-12-02 Thread Robert Osfield
Hi Himar,

If you are just resizing occassionally and its you don't have a frame
rate critical app then the overhead of recreating an FBO shouldn't be
a great issue.  Ease of use wise tweaking the internals of RenderStage
to recreate the FBO when the setup changes would be the right thing to
do long term, I'm too busy right now to go chasing such features, but
you are welcome.

Otherwise stick to your workaround, or just aim for a large enough FBO
enough for the maximum window sizes you expect to encounter.  FBO's
can go up to 4k by 4k with is far in excess of what window will ever
be so you have plenty of head room.

Robert.

On Dec 1, 2007 7:10 PM, Himar Carmona [EMAIL PROTECTED] wrote:
 Hi Robert,

  i only resize (i.e. recreate) the FBO when a resize operation is performed
 (when it is detected as finished). 99% of the time this will not happen.
 Really, my app performance is dropping due to the readback operation every
 frame. In my case this is acceptable, as i don't need constant frame rate
 (i'm rendering on demand, my app is a CAD like one). OSG is so fast doing
 its work, that the response time is good enough.

   This is my workaround to the problem i mentioned in my post:

osgViewer::Renderer* renderer =
 (osgViewer::Renderer*)camera-getRenderer();

 renderer-getSceneView(0)-getRenderStage()-setCameraRequiresSetUp(true);

 renderer-getSceneView(0)-getRenderStage()-setFrameBufferObject(NULL);

   These lines force the RenderStage to recreate the FBO, but this only
 happens when the resize operation ends.

   Your idea is better of course. But my app must be able to handle a
 multimonitor system. How can i determine in this situation what is the
 largest region i need? Is this region independent of the multimonitor
 configuration?


 Thank you for your advices, Robert. I really appreciate them.
 Himar.



 ___
 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] a bug in void osg::Polytope::setToBoundingBox ( const BoundingBox bb ) [inline]

2007-12-02 Thread Robert Osfield
Hi,

Yesterday another engineer reported this issue, a fix was posted by
myself and also checked into OSG subversion repository.  FYI, the
setFrustum method was also buggy in the same way.

Robert.

On Dec 2, 2007 1:28 AM, 祝清鲁 [EMAIL PROTECTED] wrote:
 osg-users,您好!
 does something wrong in the following code?
 void setToBoundingBox(const BoundingBox bb)
 {
 _planeList.clear();
 _planeList.push_back(Plane(1.0,0.0,0.0,-bb.xMin())); // left 
 plane.
 _planeList.push_back(Plane(-1.0,0.0,0.0,bb.xMax())); // right 
 plane.
 _planeList.push_back(Plane(0.0,1.0,0.0,-bb.yMin())); // bottom 
 plane.
 _planeList.push_back(Plane(0.0,-1.0,0.0,bb.yMax())); // top plane.
 _planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMin())); // near plane
 _planeList.push_back(Plane(0.0,0.0,1.0,bb.zMax())); // far plane
 setupMask();
 }
 when I want to create a boundingbox with the two point V_min(20,20,20), 
 V_max(100,100,100) correctly, I must use like that
 osg::Polytope pt;
 pt.setToBoundingBox(osg::BoundingBox(20,20,100,100,100,-20));

 May be the code shuoud change to:

 void setToBoundingBox(const BoundingBox bb)
 {
 _planeList.clear();
 _planeList.push_back(Plane(1.0,0.0,0.0,-bb.xMin())); // left 
 plane.
 _planeList.push_back(Plane(-1.0,0.0,0.0,bb.xMax())); // right 
 plane.
 _planeList.push_back(Plane(0.0,1.0,0.0,-bb.yMin())); // bottom 
 plane.
 _planeList.push_back(Plane(0.0,-1.0,0.0,bb.yMax())); // top plane.
 _planeList.push_back(Plane(0.0,0.0,1.0,-bb.zMin())); // near plane
 _planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMax())); // far plane
 setupMask();
 }

 ps: this bug is pointed by array(who translated the 
 OpenSceneGraph_Quick_Start_Guide to Chinese).

 致
 礼!


 祝清鲁
 [EMAIL PROTECTED]
 2007-12-02
 ___
 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] Win32 crash

2007-12-02 Thread Robert Osfield
Hi Panagiotis,

The crash could be one of many things, its not possible to pinpoint it
given the details so far.  Things to try at your end would be to force
single threaded usage via
viewer.setThreadingModel(osgViewer::ViewerBase::SingleThreaded) or
setting the env var OSG_THREADING to SingleThreaded.   Also try
different machines/graphics hardware.

Robert.

On Dec 2, 2007 3:40 PM, Panagiotis Papadakos [EMAIL PROTECTED] wrote:
 Hello.

 There is a crash in my app in windows which I can't reproduce in Linux.
 I got the attached stacktrace from VS. It seems something is going wrong
 in osgViewer::Viewer::run(). This is reproducilble with either 2.2 or
 current SVN.

 Regards
 Panagiotis Papadakos
 ___
 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] License issue with .net loader?

2007-12-02 Thread Robert Osfield
HI Robert,

On Dec 1, 2007 11:08 PM, Robert Balfour [EMAIL PROTECTED] wrote:
 Is there a potential license issue with the .net osg plugin?

Potentially yes there could be issues for some usages, the OSG itself
is perfectly OK, but use of the plugin will have to be careful to
comply, more details below.   I must admit I was unaware of this
plugin containing GPL'd work.  Don Burns wrote the OSG's .net plugin
and checked it in, I assumed that it was under the OSGPL as Don was
the principle author.

FYI, the Xine plugin is also GPL'd as it uses Xine-lib which itself is GPL'd.

 In the ReaderWriterNET plugin source directory, the sockstream.cpp
 component file has a header comment referencing the GPL license, which
 is much more limiting that the OSG LGPL(+relaxed for static linking)
 type license?

From my understanding it should be OK for a non GPL'd application to
loaded a GPL'd plugin without infringing the license, as the GPL
explictly says it covers just copying/distribution, not running of the
code.  If this wasn't possible then you wouldn't be able to run a
GPL'd application under Windows, the relationship between the various
elements of code is exactly the same.

So if you distribute your app that use a GPL'd plugin you must ensure
that your distribution of the plugin is done according to its license.
For an end user to be able to excercise their rights granted by the
GPL they will need to be able to get the source, and the dependencies
and tweak the plugin and rerun you app, this is possible whilst your
distribute the OSG as dynamic libs, but not if you statically link it.
 Static linking of the .net plugin is also breaks the license.
However, both these conditions are not difficult to meet.

As for the plugin itself it would be nice to rewrite the GPL'd parts
to make the plugin an OSGPL'd plugin just to clear up any ambiguity,
any volunteers?

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


Re: [osg-users] Win32 crash

2007-12-02 Thread Himar Carmona
Hello Panagiotis,

sometime ago i had a similar issue. nvoglnt.dll is the nvidia Driver. In
my case it was a driver problem. NVIDIA have a known uninstall issue that
didn't clean up correctly if you upgrade the driver version (even if you
uninstall previous version and install the new one). I've found a page that
explain how to cleanly uninstall the nvidia driver (in fact, deleting some
of the dlls it installs manually). I do it, and the exceptions gone.

   Perhaps doing the same may help you. Uninstall, verify that there isn't
something that looks like a nvidia driver (seach nvogl.dll and likely ones),
and reinstall the drivers.


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


Re: [osg-users] Getting world coord bounding box

2007-12-02 Thread Daniel Holz
hi,

i can't tell you much about AnimationPath objects since i never used 
them but a short glimpse on the api reference tells me that you can 
easily get a transformation matrix for any point in time of the running 
animation by using the method osg::AnimationPath::getMatrix(...).
(cf. 
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01017.html)

another way is using a ControlPoint in your TimeControlPointMap:
osg::AnimationPath::ControlPoint::getMatrix(...)
(cf. 
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01018.html)

anyway, since you control the hierarchy of the scenegraph you don't need 
a nodevisitor to find the transform of the vehicle in world cords. you 
KNOW how the transformations are done:

your scenegraph probably looks like this:

'rootNode'
|
osg::MatrixTransform 'vehicleAnimationX' (with 
vehicleNode-setUpdateCallback(new osg::AnimationPathCallback(...))
|
'vehicleX'

...whereas X refers to one of your vehicles in the scene, meaning that 
you have ONE osg::MatrixTransform node for each vehicle.

then for every time step you obtain your world transform matrix for 
vehicle X by multiplying all the matrices of the scenegraph nodes 
bottom-up and right-to-left like this:

transform of  'rootNode' * transform of 'vehicleAnimationX' * transform 
of 'vehicleX'

probably the rootNode transformation is the identity and the vehicle has 
no transform node at all so that the transformation in world coords is 
simply the transformation of 'vehicleAnimation'!

i hope this helps.
if not, try looking at this example: 
http://osgcvs.no-ip.com/osgarchiver/archives/February2005/0270.html

cheers,
daniel

Siddharth Palaniappan wrote:
 Hi Daniel,

 I tried out a seperate code example and it did work. But i couldnt get
  it working for my project. Like i previously mentioned i needed to get
  the world coordinates of the boundingboxes of the loaded openflight
  models and if the bounding boxes intersected , i wanted to stop the
  vehicle on the animation path. The world coordinates matrix that i receive
  each time, seems to be correct as i checked the position of the
  ControlPointMap by using the write() in the AnimationPath class. I am now 
 trying
  to manually get the worldcoordinates and keep altering a geode and
  attach it to the root node to see if the transformation made to the local
  coordinates do infact match. 

 Is there any code snippet around that tells how to get the world
  coordinates  for a model on an  AnimationPath? To get the world coordinates
  this is what i did - 

 class getWorldCoordOfNodeVisitor : public osg::NodeVisitor 
 {
 public:
getWorldCoordOfNodeVisitor():
   osg::NodeVisitor(NodeVisitor::TRAVERSE_PARENTS), done(false)
   {
  wcMatrix= new osg::Matrixd() ;
   }
   virtual void apply(osg::Node node)
   {
  if (!done)
  {
 if ( 0 == node.getNumParents() ) // no parents
 {
wcMatrix-set(
  osg::computeLocalToWorld(this-getNodePath()) ) ;
done = true ;
 }
 traverse(node) ;
  }
   }
   osg::Matrixd* giveUpDaMat() 
   {
  return wcMatrix ;
   }
 private:
bool done ;
osg::Matrix* wcMatrix ;
 } ;

 osg::Matrixd* getWorldCoords( osg::Node* node) 
 {
getWorldCoordOfNodeVisitor* ncv = new getWorldCoordOfNodeVisitor() ;
if (node  ncv)
{
   node-accept(*ncv) ;
   return ncv-giveUpDaMat() ;
}
else
{
   return NULL ;
}
 } 

 I have two MatrixTransform node above my vehicle model node. And i use
  this to get the World Coord transfomation matrix. The first/topmost
  transformation node is a static node to set the initial position and its
  child node is another transformation matrix which has an
  AnimationPathCallback set to(which moves the vehicle on a spline). 

 I also see that the animationpathcallback has an update function. Now , does 
 the animationpathcallback automatically update my TransformMatrix to which i 
 have set this as a callback?

 Do you think the workflow is correct? Am i missing anything? ANy
  suggestions?

 Thanks for your help...

 Siddharth



 - Original Message 
 From: Siddharth Palaniappan [EMAIL PROTECTED]
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Saturday, December 1, 2007 2:56:27 PM
 Subject: Re: [osg-users] Getting world coord bounding box


 Hi daniel,

 Yes thats a good idea..I will definitely try that and let you know how
  it works out. Thank you.

 Siddharth


 - Original Message 
 From: Daniel Holz [EMAIL PROTECTED]
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Saturday, December 1, 2007 2:50:11 PM
 Subject: Re: [osg-users] Getting world coord bounding box


 hi siddharth,

 i just started being confused reading the link you sent me when i got 
 this new email of yours :)
 if i am in a situation like this what i 

Re: [osg-users] Creating shapes using Geometry

2007-12-02 Thread Renan Mendes
Hey, Jean-Sébastien.

Now I'm asking for that example code you've offered me, if that still
stands...  I haven't tried hard enough, to be honest, but I sure have no
extra time to deal with this properly right now. Not to mention the guy I
work with, which is breathing down my neck... I would appreciate that favor
very much.

Thanks.

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


Re: [osg-users] FBO resizing problem

2007-12-02 Thread Himar Carmona
 Hi Robert,

 thanks again. For now i will stand with my workaround. I'm also running for
a deadline and really
 i have no time for things other than my project (i think there must be some
sort of pandemic disease
upon the programmers beings, i will not believe the day one programmer comes
and says  'i have a lot of time to spend on this project...')

  Well, comments apart, is there any place where i could document the
proposed changes to FBO functionality in RenderStage and stand there until i
(or anyone else) have time to try to incorporate it to the osg distribution?
Something like osg-submissions, maybe?

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


Re: [osg-users] Creating shapes using Geometry

2007-12-02 Thread Daniel Holz
hi renan,

i think he meant that you should look at the examples included in the 
osg package.
quote:

[..]and the examples that come with the OSG  
are a treasure trove of code and information.


cheers,
daniel

Renan Mendes wrote:
 Hey, Jean-Sébastien.

 Now I'm asking for that example code you've offered me, if that still 
 stands...  I haven't tried hard enough, to be honest, but I sure have 
 no extra time to deal with this properly right now. Not to mention the 
 guy I work with, which is breathing down my neck... I would appreciate 
 that favor very much.

 Thanks.

 Renan M Z Mendes
 

 ___
 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] Render To Texture problem in a Reflection algorithm

2007-12-02 Thread zhangguilian
Hi,
In an algorithm of reflection I used Render To Texture, part of the code is:

 Texture2D* reflectionTex=new Texture2D;//rtt texture 
  reflectionTex-setTextureSize(512, 512);
  reflectionTex-setInternalFormat(GL_RGBA);
  reflectionTex-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
  reflectionTex-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
  reflectionTex-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE);
  reflectionTex-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE);

  CameraNode * rttcamera=new CameraNode;//rttcam  
  rttcamera-setCullingMode(CullSettings::NO_CULLING);
  rttcamera-setCullingActive(false);
  rttcamera-setClearMask(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);

 // rttcamera-setViewport(0,0,512,512);
  rttcamera-setRenderOrder(CameraNode::PRE_RENDER);
  
rttcamera-setRenderTargetImplementation(CameraNode::FRAME_BUFFER_OBJECT,CameraNode::PIXEL_BUFFER_RTT);
 
  rttcamera-attach(osg::CameraNode::COLOR_BUFFER,reflectionTex);

  osg::ClipNode* clipNode = new osg::ClipNode;
  osg::ClipPlane* clipplane = new osg::ClipPlane;
  Plane pl(normal,point);
  clipplane-setClipPlane(pl);
  clipplane-setClipPlaneNum(0);
  clipNode-addClipPlane(clipplane);
  clipNode-addChild(reflectTransform);
  rttcamera-addChild(clipNode);

 I don't know why it running well on a GeForce 8800 GTS/PCI/SSE2 from 
NVIDIA Corporation but doesn't have any reflection effect on a GeForce4 MX 
440/AGP/SSE2 from NVIDIA Corporation,
and while I add a line:rttcamera-setViewport(0,0,512,512),the later 
machine(GeForce4 MX 440/AGP/SSE2 from NVIDIA Corporation) can have reflect 
effect,but a strange phenomena appears:
an arbitrary window(relative or irrelative with the program) over it will 
destroy the reflction map and the area destroyed will move with the window over 
it
(once the window over it moves ,the destroyed area move too) , I don't know 
what have happend and I eagerly to know how to solve the problem.

Thanks very much!
zhangguilian
2007.12.3
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Creating shapes using Geometry

2007-12-02 Thread Jean-Sébastien Guay

Hello Renan,


Now I'm asking for that example code you've offered me, if that still
stands...  I haven't tried hard enough, to be honest, but I sure have no
extra time to deal with this properly right now. Not to mention the guy I
work with, which is breathing down my neck... I would appreciate that favor
very much.


As I said, for the part about feeding the data to OSG, there are good  
resources and I can't really step you through it, unless you give us  
the specific part you're having trouble with.


On the other hand, if you're having trouble calculating the data  
itself, I attached a source file that might help for spheres and  
cylinders. Now, it's not a silver bullet, as it's pretty old, straight  
OpenGL code, and some of the comments are in French (you might use a  
translation web site for that ;-) ). But still, it may help you.


In a nutshell, to construct a sphere, I first build a display list  
with 1/6 of a sphere, pointing in one direction (say positive X).  
Then, I call that display list 6 times with a rotation each time. The  
reason for doing it that way is to avoid the singularity at the poles  
of the sphere.


For the cylinder, it's basically just making as many circles as  
needed, and then capping the tube. (come to think of it, I'm not even  
sure these cylinders were capped, as they were meant to represent a  
quadric...)


In both cases, I guess the more complicated part is figuring out how  
to make faces out of the vertices, rather than calculating the  
position of the vertices themselves. So the code may help you out with  
that part.


As I said, it's old code, so if you have trouble figuring it out, I'm  
afraid I won't be able to help much. But it may be what you need to  
nudge you in the right direction.


Good luck,

J-S
--
__
Jean-Sebastien Guay [EMAIL PROTECTED]
http://whitestar02.webhop.org/


This message was sent using IMP, the Internet Messaging Program.

/*--*/
/*  */
/**** INF4702 COMPLEMENT D'INFOGRAPHIE ***  */
/*Travaux Pratiques */
/*  */
/*fichier b_quad.cpp*/
/*  */
/*Traitement des surfaces quadriques*/
/*  */
/*Rev:07/01/2002y.m.*/
/*  */
/*--*/

#includeclass.h
#includeif540.h
#includeVector3.h
#includeQuaternion.h

#includetexture.h
#includetexture_image.h
#includetexture_procedural.h

using namespace math;
using namespace std;
/*--*/
/*  */
/*PreProc(Pre-processing: differents calculs...)*/
/*  */
/*Params:(void) */
/*  */
/*Return:(void) */
/*  */
/*Note: Cette methode est appelee apres la lecture des donnees et avant */
/*  le calcul des images.  C'est l'endroit ideal pour effectuer */
/*  les transformations de la surface et calculer des constantes.   */
/*  */
/*--*/

#ifdefOPEN_GL

extern General general;

voidQuadric::PreProc( void )
{
/*
Matrix Q( this-quad.x,this-mix.z / 2, this-mix.y / 2, this-lin.x / 
2,
  this-mix.z / 2, this-quad.y,this-mix.x / 2, this-lin.y / 
2,
  this-mix.y / 2, this-mix.x / 2, this-quad.z,this-lin.z / 
2,
  this-lin.x / 2, this-lin.y / 2, this-lin.z / 2, this-cst  
  );

Matrix S = this-transfo;
Matrix Q2 = !S * Q * ~(!S);

this-quad.x = Q2[0][0];
this-quad.y = Q2[1][1];
this-quad.z = Q2[2][2];
this-cst= Q2[3][3];
this-mix.x  = Q2[1][2] + Q2[2][1];
this-mix.y  = Q2[2][0] + Q2[0][2];
this-mix.z  = Q2[1][0] + Q2[0][1];
this-lin.x  = Q2[0][3] + 

Re: [osg-users] Render To Texture problem in a Reflection algorithm

2007-12-02 Thread Himar Carmona
Hi,

   do both graphics cards support Frame_Buffer_object ? The problem could be
in the renderfallback (i.e. PIXEL_BUFFER_RTT) if they do not support it? Try
the different RTT methods if these seems to be the problem. Also , i think
you maust set the viewport for FBO to work (i suppose it is set in another
place also)...Also, you can set the notifylevel of OSG to WARN or DEBUG and
see what is really happens.

Good luck.
Himar.


2007/12/3, zhangguilian [EMAIL PROTECTED]:

  Hi,
  In an algorithm of reflection I used Render To Texture, part of the code
 is:

  Texture2D* reflectionTex=new Texture2D;//rtt texture
   reflectionTex-setTextureSize(512, 512);
   reflectionTex-setInternalFormat(GL_RGBA);

   reflectionTex-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);

   reflectionTex-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);

   
 reflectionTex-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE);

   
 reflectionTex-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE);

   CameraNode * rttcamera=new CameraNode;//rttcam
   rttcamera-setCullingMode(CullSettings::NO_CULLING);
   rttcamera-setCullingActive(false);
   rttcamera-setClearMask(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
  // rttcamera-setViewport(0,0,512,512);
   rttcamera-setRenderOrder(CameraNode::PRE_RENDER);

   
 rttcamera-setRenderTargetImplementation(CameraNode::FRAME_BUFFER_OBJECT,CameraNode::PIXEL_BUFFER_RTT);
   rttcamera-attach(osg::CameraNode::COLOR_BUFFER,reflectionTex);

   osg::ClipNode* clipNode = new osg::ClipNode;
   osg::ClipPlane* clipplane = new osg::ClipPlane;
   Plane pl(normal,point);
   clipplane-setClipPlane(pl);
   clipplane-setClipPlaneNum(0);
   clipNode-addClipPlane(clipplane);
   clipNode-addChild(reflectTransform);
   rttcamera-addChild(clipNode);

  I don't know why it running well on a GeForce 8800 GTS/PCI/SSE2
 from NVIDIA Corporation but doesn't have any reflection effect on a GeForce4
 MX 440/AGP/SSE2 from NVIDIA Corporation,
 and while I add a line:rttcamera-setViewport(0,0,512,512),the later
 machine(GeForce4 MX 440/AGP/SSE2 from NVIDIA Corporation) can have reflect
 effect,but a strange phenomena appears:
 an arbitrary window(relative or irrelative with the program) over it will
 destroy the reflction map and the area destroyed will move with the
 window over it
 (once the window over it moves ,the destroyed area move too) , I don't
 know what have happend and I eagerly to know how to solve the problem.

 Thanks very much!
 zhangguilian
 2007.12.3

 ___
 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] osgEphemeris Moon Phase

2007-12-02 Thread Loong Hin
 
Will osgEphemeris auto compute the moon phase basing on the day of the year?
Is it possible to manually set the moon phase percentage?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org