Thanks for pointing me in the right direction Andreas.  I had tried
your suggestion yesterday an only gotten core dumps.  But since you
said it's the way to do it, I dug a little deeper.  I was setting up a
MatrixCamera as in the 18opengl_slave example.  To get rid of my core
dumps I had to add a beacon to the camera:

   NodePtr beacon = Node::create();
   mBeaconCore = Transform::create();
   beginEditCP(beacon);
      beacon->setCore(mBeaconCore);
   endEditCP(beacon);
   beginEditCP(mMatrixCamera);
      mMatrixCamera->setBeacon(beacon);
   endEditCP(mMatrixCamera);

And to make OSGInvViewMatrix update, I had to update it myself when I
updated my camera:

      // retrieve OpenGL's matrices
      Real32 proj_matrix[16], model_matrix[16];
      glGetFloatv(GL_PROJECTION_MATRIX, proj_matrix);
      glGetFloatv(GL_MODELVIEW_MATRIX, model_matrix);
      Matrix proj, model;
      proj.setValue(proj_matrix);
      model.setValue(model_matrix);

      // use OpenGL matrices in OpenSG camera
      beginEditCP(mMatrixCamera);
         mMatrixCamera->setProjectionMatrix(proj);
         mMatrixCamera->setModelviewMatrix(model);
      endEditCP(mMatrixCamera);
      beginEditCP(mBeaconCore);
         mBeaconCore->setMatrix(model);
      endEditCP(mBeaconCore);

So, I'm not really getting OSGInvViewMatrix for free this way.  It
would be easier to pass it to the shader program myself.  I know there
are other methods for setting up cameras that I haven't tried yet. 
Would another camera setup be more appropriate for me?

- Terry

> Message: 2
> Date: Sat, 23 Apr 2005 14:18:35 +0200
> From: Andreas Zieringer <[EMAIL PROTECTED]>
> To:  [email protected]
> Subject: Re: [Opensg-users] activating OSGInvViewMatrix
> Reply-To: [email protected]
> 
> Hi Terry,
> 
> you just have to add the parameter to the SHLChunk that's all.
> 
> Andreas
> 
> shl->setUniformParameter("OSGInvViewMatrix ", Matrix());
> 
> > I have used SHLChunk's OSGInvViewMatrix in vred with great results.
> > However, I can't seem to get it working in my own program.  The matrix
> > appears to be all zeroes in my shader.  Is there something I have to
> > do to activate OSGInvViewMatrix and all those other built-in uniforms?


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&opÿick
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to