Re: [osg-users] How to use shader and shadow together in one scene

2011-05-11 Thread Turgut Mehdiyev
Hi Chris,

Thank you for your help. First i add all my nodes to group and after this group 
added to shadowed scene. And to one of the nodes or more i apply shaders. I 
understand that shadowmap shader program overrides the custom shader program. I 
try to override shadow custom settings but no effect. Maybe anybody have real 
solution for that? 


Thank you!

Turgut

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





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


[osg-users] save a movie

2011-05-11 Thread Gianni Ambrosio
Hi All,
I know this topic have been already discussed in the past but I didn't find 
clear solution.

Basically I need to save a movie of what is shown in an osgViewer embedded in a 
Qt widget.
I gave a rough look at the osgscreencapture example. Is the recommended way to 
implement what I need?

Regards
Gianni

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





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


[osg-users] osgShadow and osgearth

2011-05-11 Thread Kumar Saurabh Arora
I am trying to implement the shadow of an object flying above the earth(
rendered from osgEarth). It is not working . I tried every technique, none
of them are working. But if I render simple sphere of same size in place of
osgearth, then shadow works on the sphere. Is there anything else I am
missing?

 

Cheers

Sumit Pandey

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


Re: [osg-users] OpenNI(Kinect) and osgAnimation

2011-05-11 Thread Aitor Ardanza
Hi,

I'll do a little guide to connect osg 2.9.11 with openni.

The first thing you should do is to build a class that is responsible for 
controlling openni. We can get many ideas from openni SDK demos. I will focus 
on how to get the information from the bones of the skeleton to pass them to 
osgAnimation. This could be the function we need:

Code:
void OpenNIControl::updateJoint(XnUserID player, XnSkeletonJoint eJoint, 
osg::Matrix* tracker)
{
if (!g_UserGenerator.GetSkeletonCap().IsTracking(player)){
printf(not tracked!\n);
return;
}

XnSkeletonJointOrientation jointOrient;
g_UserGenerator.GetSkeletonCap().GetSkeletonJointOrientation(player, eJoint, 
jointOrient);

XnSkeletonJointPosition jointPos;
g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, 
jointPos);

if(jointPos.fConfidence  0.5 || jointOrient.fConfidence  0.5){
return;
}

XnMatrix3X3 orient;
orient = jointOrient.orientation;

osg::Matrix mat(orient.elements[0], orient.elements[1], orient.elements[2], 0,
orient.elements[3], orient.elements[4], orient.elements[5], 0,
orient.elements[6], orient.elements[7], orient.elements[8], 0,
jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1);

tracker-set(osg::Matrix::inverse(mat));
}



We must keep in mind which the system is openni with Y up. So when we go to 
create the skeleton of the model in a modeling program (Maya), the orientation 
of the bones have which contemplate this. We can export to fbx for example.

After parsing global matrix to local, we only need to pass the new rotation 
matrix of each bone at every time step.

Code:

for(int 
j=0;jsceneM-getAnimatedModel()[0]-boneMatrices.size();j++){
std::string boneName = 
sceneM-getAnimatedModel()[0]-boneMatrices[j]-getName();

if(!sceneM-getAnimatedModel()[0]-boneMatrices[j]-getName().compare(Torso)){
osg::Matrix 
mat(osg::Matrix::inverse(*jointsTracker[XN_SKEL_WAIST-1]));
mat.preMult(*jointsTracker[XN_SKEL_TORSO-1]);

sceneM-getAnimatedModel()[0]-boneMatrices[j]-setMatrix(mat);
}

if(!sceneM-getAnimatedModel()[0]-boneMatrices[j]-getName().compare(R_Shoulder)){
osg::Matrix 
mat(osg::Matrix::inverse(*jointsTracker[XN_SKEL_NECK-1]));

mat.preMult(*jointsTracker[XN_SKEL_RIGHT_SHOULDER-1]);

sceneM-getAnimatedModel()[0]-boneMatrices[j]-setMatrix(mat);
}

if(!sceneM-getAnimatedModel()[0]-boneMatrices[j]-getName().compare(R_Elbow)){
osg::Matrix 
mat(osg::Matrix::inverse(*jointsTracker[XN_SKEL_RIGHT_SHOULDER-1]));

mat.preMult(*jointsTracker[XN_SKEL_RIGHT_ELBOW-1]);

sceneM-getAnimatedModel()[0]-boneMatrices[j]-setMatrix(mat); 
}
}
//update scene animated model
sceneM-getAnimatedModel()[0]-update();





Code:
void AnimatedModel::update()
{
for(int i = 0; im_bones.size();i++)
{   
while(pBoneUpdate.at(i)-getStackedTransforms().size()6){
pBoneUpdate.at(i)-getStackedTransforms().pop_back();
}

if(!m_bones.at(i)-getName().compare(Waist)){
pBoneUpdate.at(i)-getStackedTransforms().push_back(new 
osgAnimation::StackedTranslateElement(
trans,modelTranslate));
}

pBoneUpdate.at(i)-getStackedTransforms().push_back(new 
osgAnimation::StackedQuaternionElement(
rotate,boneMatrices[i]-getMatrix().getRotate()));

}
}



And that's the whole idea of how to work with openni ... I know it's very 
general but now I haven't time for more ... and also sorry for my English ...

Thank you!

Cheers,
Aitor

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





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


Re: [osg-users] osgShadow and osgearth

2011-05-11 Thread Torben Dannhauer
Hi,

as far as I know, osgEarth ist shader based, so you have to integrate your 
shadow in the osgEarth shaders (look for shader Composition)


Cheers,
Torben

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





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


[osg-users] [vpb] vpbmaster and aspect ratio 2

2011-05-11 Thread Ido Schwartzman
Hi,

I've come across a problem when building databases with sources that have 
aspect ratios which are bigger than 2 when using vpbmaster - it seems to work 
fine with osgdem, but not with vpbmaster. I believe the problem is that several 
DataSet methods assume each tile is divided by two at at the most, while long 
and narrow (or wide and short) sources can actually be divided, at level 1, 
into three or more tiles. This is evident in 
DataSet::createNewDestinationGraph, where the j_lower value is calculated by 
right-shifting only. That is also why (I think...) it only affects vpbmaster 
builds - that piece of code is inside the if (getGenerateSubtile()) clause - 
that's why my osgdem builds work fine for the same dataset (no entry into that 
block).

So...I would be very happy to try and fix it as my first OSG/VPB contribution, 
but since I still don't know enough about the code, I'm afraid I'll wrack 
something. Looks like a more complex calculation inside the if 
(getGenerateSubtile()) block, which uses _C1 and _R1 would do the trick, but 
might not be enough.

Thoughts anyone?

Bye for now,
Ido Schwartzman

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





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


Re: [osg-users] osgShadow and osgearth

2011-05-11 Thread Glenn Waldron
Sumit,
Please see my response to your post in the osgEarth forum for an answer.

http://forum.osgearth.org/Shadow-in-osgearth-td6351086.html


Glenn Waldron / Pelican Mapping / @glennwaldron


On Wed, May 11, 2011 at 5:15 AM, Kumar Saurabh Arora saur...@vizexperts.com
 wrote:

  I am trying to implement the shadow of an object flying above the earth(
 rendered from osgEarth). It is not working . I tried every technique, none
 of them are working. But if I render simple sphere of same size in place of
 osgearth, then shadow works on the sphere. Is there anything else I am
 missing?



 Cheers

 Sumit Pandey

 ___
 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] Problems embedding osgViewer::Viewer in Qt MainWindow (not CompositeViewer)

2011-05-11 Thread Sanat Talmaki
Hi Sergey,

Thanks for your reply and suggestions. I will take a look at the link you 
mentioned. 

Regards,
Sanat

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





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


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Ryan Pavlik
On Tue, May 10, 2011 at 8:24 PM, Paul Martz pma...@skew-matrix.com wrote:

 On 5/10/2011 7:11 PM, Paul Martz wrote:

 On 5/3/2011 3:02 PM, Ryan Pavlik wrote:

 I'd like to propose my fixes that I sent in on -submissions pre-2.8.4:
 all
 except the VC2010 build fix still apply. They are these two:

 Improvements to osgconv:

 https://github.com/rpavlik/osg/compare/OpenSceneGraph-2.8...improve-osgconv

 (I've also forward-ported these to trunk:
 https://github.com/rpavlik/osg/compare/master...improve-osgconv-trunk )


 So, if I understand correctly, you did not post this change to
 osg-submissions
 for inclusion in OSG's svn trunk, is that correct? Or, you did post them,
 but
 they are awaiting action by Robert?

 Has anyone other than you tested the changes?

 What, exactly, are these improvements to osgconv? (No, I haven't looked at
 the
 code -- yet.)


 Having reviewed the code, I see two changes:

 1) A simple change to an error message in osgconv.cpp. Looks
 straightforward.

 2) A change to the image file name format as output by the dot OSG plugin.
 Not sure I understand this one, but it doesn't appear to be an improvement
 to osgconv. Did you include this by mistake?

   -Paul


No, the .osg plugin modification essentially only affects use of osgconv.
 What it does is, if  the OutputTextureFiles option is turned on (such as by
passing -O OutputTextureFiles to osgconv), it will create a directory as a
sibling to the desired output file, create the textures in that directory,
and use relative file names in the output osg file so that as long as the
osg file and its matching texture directory are moved together, textures are
found.  Previously, the output location was less clear and an absolute path
was specified in the resulting osg file, which rather negated the effect of
choosing to output texture files, since the osg file would no longer have
textures if moved to a new location.

Hopefully this makes it a bit more clear.

Ryan



-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Ryan Pavlik
On Tue, May 10, 2011 at 8:11 PM, Paul Martz pma...@skew-matrix.com wrote:

 On 5/3/2011 3:02 PM, Ryan Pavlik wrote:

 I'd like to propose my fixes that I sent in on -submissions pre-2.8.4: all
 except the VC2010 build fix still apply. They are these two:

 Improvements to osgconv:

 https://github.com/rpavlik/osg/compare/OpenSceneGraph-2.8...improve-osgconv

 (I've also forward-ported these to trunk:
 https://github.com/rpavlik/osg/compare/master...improve-osgconv-trunk )


 So, if I understand correctly, you did not post this change to
 osg-submissions for inclusion in OSG's svn trunk, is that correct? Or, you
 did post them, but they are awaiting action by Robert?


I hadn't done the forward-port to trunk until I sent this email. I did not
post the trunk version of this change to osg-submissions, though I did post
the 2.8 branch one.

Has anyone other than you tested the changes?


Nobody besides me has built it, though we've been using these binaries on a
number of systems here in our lab.

What, exactly, are these improvements to osgconv? (No, I haven't looked at
 the code -- yet.)


  Fixes to the osgWrappers:
 https://github.com/rpavlik/osg/compare/OpenSceneGraph-2.8...fix-wrappers


 Thanks! These are now committed to the 2.8 branch. Please test to verify
 they were applied correctly.

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




-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Paul Martz

On 5/11/2011 11:21 AM, Ryan Pavlik wrote:

So, if I understand correctly, you did not post this change to
osg-submissions for inclusion in OSG's svn trunk, is that correct? Or, you
did post them, but they are awaiting action by Robert?


I hadn't done the forward-port to trunk until I sent this email. I did not post
the trunk version of this change to osg-submissions, though I did post the 2.8
branch one.


Now that I think about it, adding this change to trunk would not be appropriate, 
as the dot OSG plugin is deprecated in trunk.

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


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Paul Martz

On 5/11/2011 11:20 AM, Ryan Pavlik wrote:



On Tue, May 10, 2011 at 8:24 PM, Paul Martz pma...@skew-matrix.com
mailto:pma...@skew-matrix.com wrote:

On 5/10/2011 7:11 PM, Paul Martz wrote:

On 5/3/2011 3:02 PM, Ryan Pavlik wrote:

I'd like to propose my fixes that I sent in on -submissions
pre-2.8.4: all
except the VC2010 build fix still apply. They are these two:

Improvements to osgconv:

https://github.com/rpavlik/osg/compare/OpenSceneGraph-2.8...improve-osgconv

(I've also forward-ported these to trunk:

https://github.com/rpavlik/osg/compare/master...improve-osgconv-trunk )


So, if I understand correctly, you did not post this change to
osg-submissions
for inclusion in OSG's svn trunk, is that correct? Or, you did post
them, but
they are awaiting action by Robert?

Has anyone other than you tested the changes?

What, exactly, are these improvements to osgconv? (No, I haven't looked
at the
code -- yet.)


Having reviewed the code, I see two changes:

1) A simple change to an error message in osgconv.cpp. Looks 
straightforward.

2) A change to the image file name format as output by the dot OSG plugin.
Not sure I understand this one, but it doesn't appear to be an improvement
to osgconv. Did you include this by mistake?

   -Paul


No, the .osg plugin modification essentially only affects use of osgconv.  What
it does is, if  the OutputTextureFiles option is turned on (such as by passing
-O OutputTextureFiles to osgconv),


...or anytime OutputTextureFiles is present in the Options string. This 
functionality is orthogonal to osgconv. Any application can access it anytime 
they write a dot OSG file. This change will affect more than osgconv.

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


Re: [osg-users] How to use shader and shadow together in one scene

2011-05-11 Thread Paul Martz

On 5/11/2011 12:51 AM, Turgut Mehdiyev wrote:

Hi Chris,

Thank you for your help. First i add all my nodes to group and after this group 
added to shadowed scene. And to one of the nodes or more i apply shaders. I 
understand that shadowmap shader program overrides the custom shader program. I 
try to override shadow custom settings but no effect. Maybe anybody have real 
solution for that?


You could mark your own shaders as PROTECTED, but is that really what you want? 
Or do you want to combine the functionality of the shadow shader with your 
shader? If so, then that's what you should do.

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


[osg-users] Crashing when calling viewer-done()

2011-05-11 Thread Robert Kern
Hi,

I'm having a problem with my application crashing when I try to create a 
while(!viewer-done()) loop. The run time error I am getting is:

Unhandled exception at 0x00361710 in elevator.exe: 0xC005: Access violation 
reading location 0x0415.

Could someone take a look and help me out?



Code:
#include osg/Geode
#include osg/Group
#include osg/MatrixTransform
#include osg/NodeVisitor
#include osg/Notify
#include osg/PositionAttitudeTransform
#include osg/Quat
#include osg/TexGen

#include osgDB/DatabasePager
#include osgDB/ReadFile
#include osgDB/Registry

#include osgUtil/IntersectVisitor
#include osgUtil/Optimizer

#include osgViewer/Viewer
#include osgViewer/ViewerEventHandlers

#include gl/gl.h
#include GL/glu.h
#include GL/glut.h
#include stdlib.h
#include iostream


int main( int argc, char **argv )
{

initTracker();

// initialize the viewer.
osg::ArgumentParser arguments(argc,argv);

viewer = new osgViewer::Viewer(arguments);


osg::Group* elevatorRoot = new osg::Group();

//create nodes: later for full tower, consider arrays of nodes
osg::Node* elevatorNode = NULL;
osg::Node* elevatorShaftNode= NULL;
osg::Node* chamberNode  = NULL;


//create transformers
osg::PositionAttitudeTransform* rootPATXform= new 
osg::PositionAttitudeTransform();
osg::PositionAttitudeTransform* elevatorXform   = new 
osg::PositionAttitudeTransform();
osg::PositionAttitudeTransform* elevatorShaftXform  = new 
osg::PositionAttitudeTransform();
osg::PositionAttitudeTransform* chamberXform= new 
osg::PositionAttitudeTransform();

//create textures
osg::Texture2D* elevatorTexture = new osg::Texture2D;
osg::Texture2D* elevatorShaftTexture= new 
osg::Texture2D;
osg::Texture2D* chamberTexture  = new osg::Texture2D;

elevatorTexture-setDataVariance(osg::Object::DYNAMIC);
elevatorShaftTexture-setDataVariance(osg::Object::DYNAMIC);
chamberTexture-setDataVariance(osg::Object::DYNAMIC);



//load models
elevatorNode= 
osgDB::readNodeFile(C:/3DVisualizer_Ped_Walk/VE_Model/ElevatorModelsV2.obj);
elevatorShaftNode   = 
osgDB::readNodeFile(C:/3DVisualizer_Ped_Walk/VE_Model/ElevatorShaftsModelV2.obj);
chamberNode = 
osgDB::readNodeFile(C:/3DVisualizer_Ped_Walk/VE_Model/Floor.obj);


//add transformers to root
elevatorRoot-addChild(elevatorXform);
elevatorRoot-addChild(elevatorShaftXform);
elevatorRoot-addChild(chamberXform);


//add models to graph
rootPATXform-addChild(elevatorRoot);
elevatorXform-addChild(elevatorNode);
elevatorShaftXform-addChild(elevatorShaftNode);
chamberXform-addChild(chamberNode);


//scale and position elements
float rotate= 3.1415926/2.0;
osg::Vec3d axis = osg::Vec3d(0,0,1);
osg::Vec3d position = osg::Vec3d(0.0,0.0,.000);
osg::Vec3d farPos   = osg::Vec3d(5.30,0.0,.00);

//Scale and position the chamber
osg::Quat rootElevatorQuat = chamberXform-getAttitude();
rootElevatorQuat.makeRotate(rotate,axis);
chamberXform-setAttitude(rootElevatorQuat);
chamberXform-setPosition(position);

//Scale and position the elevator
rootElevatorQuat = elevatorXform-getAttitude();
rootElevatorQuat.makeRotate(rotate,axis);
elevatorXform-setAttitude(rootElevatorQuat);
elevatorXform-setPosition(position);

//Scale and position the elevator Shaft
rootElevatorQuat = elevatorShaftXform-getAttitude();
rootElevatorQuat.makeRotate(rotate,axis);
elevatorShaftXform-setAttitude(rootElevatorQuat);
elevatorShaftXform-setPosition(position);


//load Textures
osg::Image* elevatorTextureImage = 
osgDB::readImageFile(C:/3DVisualizer_Ped_Walk/VE_Model/ElevatorTexture.jpg);
if (!elevatorTextureImage)
{
cout   couldn't find elevator texture.  std::endl;
}
else{
elevatorTexture-setImage(elevatorTextureImage);

elevatorNode-getOrCreateStateSet()-setTextureAttributeAndModes( 0, 
elevatorTexture, osg::StateAttribute::ON);
}


osg::Image* elevatorShaftTextureImage = 
osgDB::readImageFile(C:/3DVisualizer_Ped_Walk/VE_Model/ElevatorShaftTextureV2.jpg);
if (!elevatorShaftTextureImage)
{
std::cout   couldn't find elevator shaft texture.  
std::endl;
}
else{
elevatorShaftTexture-setImage(elevatorShaftTextureImage);

elevatorShaftNode-getOrCreateStateSet()-setTextureAttributeAndModes( 0, 

Re: [osg-users] Crashing when calling viewer-done()

2011-05-11 Thread Chris 'Xenon' Hanson
On 5/11/2011 12:50 PM, Robert Kern wrote:
 Access violation reading location 0x0415

  Without even reading the code, this usually indicates trying to read a NULL 
pointer as a
pointer to an object.

  Check all your pointers in the debugger at the point you've crashed at.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crashing when calling viewer-done()

2011-05-11 Thread Jean-Sébastien Guay

Hello Robert,


I'm having a problem with my application crashing when I try to create a 
while(!viewer-done()) loop. The run time error I am getting is:

Unhandled exception at 0x00361710 in elevator.exe: 0xC005: Access violation 
reading location 0x0415.


You should run your program in a debugger and see where it crashes. This 
kind of message is totally useless, and just running in a debugger will 
likely point out exactly where the problem occurs, and since you have 
the code in front of you, you'll be able to fix it.



Could someone take a look and help me out?


In the posted code, several functions are not declared or defined 
(initTracker(), camUpdate(viewer) ) and I don't even see where the 
viewer variable is declared. You don't seem to be including any of your 
own headers so I don't see where those come from. We can have a quick 
look at some code but that's generally not very useful as it will leave 
us with more questions than answers. Post the complete code to a small 
example that reproduces your issue for best results.


In your particular case I'd be suspicious of the camUpdate(viewer) 
function, since it's being passed a pointer to the viewer, we can't know 
what's going on in there but something bad seems to be happening to the 
viewer.


Then again, you might also be mixing release and debug binaries when 
compiling, we have no way of knowing that either. A lot has been said 
about the need to be sure you link release with release, debug with 
debug when using Visual C++. Have a search in the archives or the forum 
for more details.


Hope this helps,

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


[osg-users] How to update uniform not continually

2011-05-11 Thread Nan WANG
Hello:

I am wondering about how to update an uniform not continually.
here is the sample code:

Code:

osg::Uniform* lightPosU = 
  new osg::Uniform(LightPosition,osg::Vec3(0,0,1));
bumpMapState-addUniform(lightPosU);




Then I would like to update lightPosU, from Vec3(0,0,1) to Vec3(0,0,10);
As I know Uniform has a setUpdateCallback function which allows continually 
update one of concerned nodes once each frame, like this:

Code:

class updateBumpShader : public osg::Uniform::Callback
{
public:
   virtual void operator() 
  ( osg::Uniform* uniform, osg::NodeVisitor* nv )
   {
  float angle = nv-getFrameStamp()-getReferenceTime();
  float x = sinf(angle)*.2f;
  float y = cosf(angle)*.2f;
  osg::Vec3 lightPos(x,y,.6f);
  uniform-set(lightPos);
   }
};



then using following codes to setUpdateCallback

Code:

lightPosU-setUpdateCallback(new updateBumpShader() );




Is there a method to update the uniform only one time? just modify the value...
I have to customize the setUpdateCallback function?

Or Can I overwrite the uniform then re pass it to Shader?

Thank you!

Cheers,
Nan

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





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


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Ryan Pavlik
On Wed, May 11, 2011 at 1:27 PM, Paul Martz pma...@skew-matrix.com wrote:

 On 5/11/2011 11:20 AM, Ryan Pavlik wrote:



 On Tue, May 10, 2011 at 8:24 PM, Paul Martz pma...@skew-matrix.com
 mailto:pma...@skew-matrix.com wrote:

On 5/10/2011 7:11 PM, Paul Martz wrote:

On 5/3/2011 3:02 PM, Ryan Pavlik wrote:

I'd like to propose my fixes that I sent in on -submissions
pre-2.8.4: all
except the VC2010 build fix still apply. They are these two:

Improvements to osgconv:

 https://github.com/rpavlik/osg/compare/OpenSceneGraph-2.8...improve-osgconv

(I've also forward-ported these to trunk:

 https://github.com/rpavlik/osg/compare/master...improve-osgconv-trunk )


So, if I understand correctly, you did not post this change to
osg-submissions
for inclusion in OSG's svn trunk, is that correct? Or, you did post
them, but
they are awaiting action by Robert?

Has anyone other than you tested the changes?

What, exactly, are these improvements to osgconv? (No, I haven't
 looked
at the
code -- yet.)


Having reviewed the code, I see two changes:

1) A simple change to an error message in osgconv.cpp. Looks
 straightforward.

2) A change to the image file name format as output by the dot OSG
 plugin.
Not sure I understand this one, but it doesn't appear to be an
 improvement
to osgconv. Did you include this by mistake?

   -Paul


 No, the .osg plugin modification essentially only affects use of osgconv.
  What
 it does is, if  the OutputTextureFiles option is turned on (such as by
 passing
 -O OutputTextureFiles to osgconv),


 ...or anytime OutputTextureFiles is present in the Options string. This
 functionality is orthogonal to osgconv. Any application can access it
 anytime they write a dot OSG file. This change will affect more than
 osgconv.

   -Paul


Well, yes. In retrospect, I didn't name the patch very accurately given its
contents - I created it while working on osgconv which is presumably why I
mentioned osgconv in the name.

In any case, we can consider it as a separate patch, to the .osg writer
plugin. My intent was to make saving models with textures to OSG format work
better.  In all of the following cases, insert the qualification with
OutputTextureFiles enabled - behavior does not change unless this option is
added. Before and after the patch, loading an .osg model in the place where
it was initially saved works. After the patch, however, the textures go to a
subdirectory named in a way that clearly links it with the model that uses
it, and loading the saved model from another location as long as the
textures were also copied/moved works correctly.  The only case I can see
that worked before and won't work after, is if the .osg file alone is
moved/copied somewhere else, but the textures remain in the
originally-exported location. (This is due to the fact that it now exports
relative paths.)

As a useful side-effect (for privacy/security) of using relative paths, .osg
files saved with this option turned on don't reveal details about the file
organization of the computer they were saved on.

Would this be an improvement that would better be separated into a distinct
option string like OutputRelativeTextures or something like that?

Ryan

-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to update uniform not continually

2011-05-11 Thread Nan WANG
Can I do like this? 
lightPosU.set (osg::Vec3(0,0,10));

then
bumpMapState-addUniform(lightPosU); 
this is a right way to do that?

... 

Thank you!

Cheers,
Nan

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





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


Re: [osg-users] How to update uniform not continually

2011-05-11 Thread Farshid Lashkari
Hi Nan,

You only need to call addUniform once. After that, just calling
lightPosU.set() should be enough to update the value of the uniform.

Cheers,
Farshid

On Wed, May 11, 2011 at 12:48 PM, Nan WANG nan.c...@gmail.com wrote:

 Can I do like this?
 lightPosU.set (osg::Vec3(0,0,10));

 then
 bumpMapState-addUniform(lightPosU);
 this is a right way to do that?

 ...

 Thank you!

 Cheers,
 Nan

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





 ___
 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 update uniform not continually

2011-05-11 Thread Nan WANG
Thanks a lot Farshid Lashkari

But I think I should first 
lightPosU.set (osg::Vec3(0,0,10)); 
Then adduniform

Am I right?

... 

Thank you!

Cheers,
Nan

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





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


Re: [osg-users] Crashing when calling viewer-done()

2011-05-11 Thread Robert Kern
Hi,


 You should run your program in a debugger and see where it crashes.


Thanks, I'll try that.


 In the posted code, several functions are not declared or defined 
 (initTracker(), camUpdate(viewer) ) and I don't even see where the 
 viewer variable is declared. You don't seem to be including any of your 
 own headers so I don't see where those come from. We can have a quick 
 look at some code but that's generally not very useful as it will leave 
 us with more questions than answers. Post the complete code to a small 
 example that reproduces your issue for best results.
 
 In your particular case I'd be suspicious of the camUpdate(viewer) 
 function, since it's being passed a pointer to the viewer, we can't know 
 what's going on in there but something bad seems to be happening to the 
 viewer.


The functions are there, I just didn't post them because they a bit lengthy and 
I thought it would be a little superflous. Though I guess I could have noted 
that I left them out. I know the problem isn't with the camUpdate() function 
because through a little debugging, I realized that the program was crashing 
before it ever reached that function call. I'll keep working on it.

Thank you!

Cheers,
Robert

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





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


[osg-users] Fluctuations in frame rate for static scene

2011-05-11 Thread Kris Dale
Good morning/afternoon/evening, whatever your timezone,

First and foremost, before we go anywhere...  I KNOW GLXGEARS AND/OR OTHER 
REALLY SIMPLE RENDERING IS NOT A BENCHMARK AND I AM NOT USING IT AS SUCH.  
Please no frothing at the mouth when I mention the fps it spits out later.  I 
have a specific reason for this simple app and comparison to 'gears, so just..  
bear with me pretty please.  :)

I've got an ultra simple OSG application I've written, and I'm not sure why, 
but I've got a very strange fluctuation in the frame rate.  The app is intended 
to be absurdly simple, only 32x32 pixels, and displays a static image, just a 
single node, matrixtransformed a little ways away from the camera.  

I'm running on a machine with a GeForce 480 that alternates between reporting 
the frame rate at around 13000fps and 10300fps.  Taking a sample of the elapsed 
time every 10 frames, I'll get one long string of ~13000fps in a row, then 
one long string of ~10300fps in a row.  

I can't find a reason for the variation, given I'm rendering a static scene.  
Running glxgears, I get a very steady ~18000, so if it was something OS/GPU 
related, I'd expect the fluctuations to be popping up there as well.

Does anyone have any thoughts or suggestions as to what might be the issue?

Kris

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





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


Re: [osg-users] Fluctuations in frame rate for static scene

2011-05-11 Thread Kris Dale
Alright, slight update:

I am seeing the fluctuations in osgviewer as well, but anything I run that's 
strictly OpenGL is steady.  Is this indicative of something being up with my 
OSG build perhaps?  I'm building against release libraries, I've already double 
checked that

Kris





omdown wrote:
 Good morning/afternoon/evening, whatever your timezone,
 
 First and foremost, before we go anywhere...  I KNOW GLXGEARS AND/OR OTHER 
 REALLY SIMPLE RENDERING IS NOT A BENCHMARK AND I AM NOT USING IT AS SUCH.  
 Please no frothing at the mouth when I mention the fps it spits out later.  I 
 have a specific reason for this simple app and comparison to 'gears, so 
 just..  bear with me pretty please.  :)
 
 I've got an ultra simple OSG application I've written, and I'm not sure why, 
 but I've got a very strange fluctuation in the frame rate.  The app is 
 intended to be absurdly simple, only 32x32 pixels, and displays a static 
 image, just a single node, matrixtransformed a little ways away from the 
 camera.  
 
 I'm running on a machine with a GeForce 480 that alternates between reporting 
 the frame rate at around 13000fps and 10300fps.  Taking a sample of the 
 elapsed time every 10 frames, I'll get one long string of ~13000fps in a 
 row, then one long string of ~10300fps in a row.  
 
 I can't find a reason for the variation, given I'm rendering a static scene.  
 Running glxgears, I get a very steady ~18000, so if it was something OS/GPU 
 related, I'd expect the fluctuations to be popping up there as well.
 
 Does anyone have any thoughts or suggestions as to what might be the issue?
 
 Kris


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





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


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Paul Martz

On 5/11/2011 1:46 PM, Ryan Pavlik wrote:



On Wed, May 11, 2011 at 1:27 PM, Paul Martz pma...@skew-matrix.com
mailto:pma...@skew-matrix.com wrote:

On 5/11/2011 11:20 AM, Ryan Pavlik wrote:



On Tue, May 10, 2011 at 8:24 PM, Paul Martz pma...@skew-matrix.com
mailto:pma...@skew-matrix.com
mailto:pma...@skew-matrix.com mailto:pma...@skew-matrix.com wrote:

On 5/10/2011 7:11 PM, Paul Martz wrote:

On 5/3/2011 3:02 PM, Ryan Pavlik wrote:

I'd like to propose my fixes that I sent in on -submissions
pre-2.8.4: all
except the VC2010 build fix still apply. They are these two:

Improvements to osgconv:

https://github.com/rpavlik/osg/compare/OpenSceneGraph-2.8...improve-osgconv

(I've also forward-ported these to trunk:
https://github.com/rpavlik/osg/compare/master...improve-osgconv-trunk )


So, if I understand correctly, you did not post this change to
osg-submissions
for inclusion in OSG's svn trunk, is that correct? Or, you did 
post
them, but
they are awaiting action by Robert?

Has anyone other than you tested the changes?

What, exactly, are these improvements to osgconv? (No, I haven't
looked
at the
code -- yet.)


Having reviewed the code, I see two changes:

1) A simple change to an error message in osgconv.cpp. Looks
straightforward.

2) A change to the image file name format as output by the dot OSG
plugin.
Not sure I understand this one, but it doesn't appear to be an
improvement
to osgconv. Did you include this by mistake?

   -Paul


No, the .osg plugin modification essentially only affects use of
osgconv.  What
it does is, if  the OutputTextureFiles option is turned on (such as by
passing
-O OutputTextureFiles to osgconv),


...or anytime OutputTextureFiles is present in the Options string. This
functionality is orthogonal to osgconv. Any application can access it
anytime they write a dot OSG file. This change will affect more than 
osgconv.

   -Paul


Well, yes. In retrospect, I didn't name the patch very accurately given its
contents - I created it while working on osgconv which is presumably why I
mentioned osgconv in the name.

In any case, we can consider it as a separate patch, to the .osg writer plugin.
My intent was to make saving models with textures to OSG format work better.  In
all of the following cases, insert the qualification with OutputTextureFiles
enabled - behavior does not change unless this option is added. Before and
after the patch, loading an .osg model in the place where it was initially saved
works. After the patch, however, the textures go to a subdirectory named in a
way that clearly links it with the model that uses it, and loading the saved
model from another location as long as the textures were also copied/moved works
correctly.  The only case I can see that worked before and won't work after, is
if the .osg file alone is moved/copied somewhere else, but the textures remain
in the originally-exported location. (This is due to the fact that it now
exports relative paths.)

As a useful side-effect (for privacy/security) of using relative paths, .osg
files saved with this option turned on don't reveal details about the file
organization of the computer they were saved on.

Would this be an improvement that would better be separated into a distinct
option string like OutputRelativeTextures or something like that?


Yes, that's the way I'm leaning now. Your patch changes behavior, and would 
break any apps or utilities that depend on the current behavior. I'd be a lot 
more comfortable with this if it were a feature addition rather than a change to 
existing functionality.


Do you think OutputRelativeTextures is a good name for it? If so, I can 
rewrite the submission locally (but you'll need to test it).

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


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Ryan Pavlik
On Wed, May 11, 2011 at 5:19 PM, Paul Martz pma...@skew-matrix.com wrote:

 On 5/11/2011 1:46 PM, Ryan Pavlik wrote:



 On Wed, May 11, 2011 at 1:27 PM, Paul Martz pma...@skew-matrix.com
 mailto:pma...@skew-matrix.com wrote:

On 5/11/2011 11:20 AM, Ryan Pavlik wrote:



On Tue, May 10, 2011 at 8:24 PM, Paul Martz 
 pma...@skew-matrix.com
mailto:pma...@skew-matrix.com
mailto:pma...@skew-matrix.com mailto:pma...@skew-matrix.com
 wrote:

On 5/10/2011 7:11 PM, Paul Martz wrote:

On 5/3/2011 3:02 PM, Ryan Pavlik wrote:

I'd like to propose my fixes that I sent in on
 -submissions
pre-2.8.4: all
except the VC2010 build fix still apply. They are these
 two:

Improvements to osgconv:

 https://github.com/rpavlik/osg/compare/OpenSceneGraph-2.8...improve-osgconv

(I've also forward-ported these to trunk:

 https://github.com/rpavlik/osg/compare/master...improve-osgconv-trunk )


So, if I understand correctly, you did not post this change
 to
osg-submissions
for inclusion in OSG's svn trunk, is that correct? Or, you
 did post
them, but
they are awaiting action by Robert?

Has anyone other than you tested the changes?

What, exactly, are these improvements to osgconv? (No, I
 haven't
looked
at the
code -- yet.)


Having reviewed the code, I see two changes:

1) A simple change to an error message in osgconv.cpp. Looks
straightforward.

2) A change to the image file name format as output by the dot
 OSG
plugin.
Not sure I understand this one, but it doesn't appear to be an
improvement
to osgconv. Did you include this by mistake?

   -Paul


No, the .osg plugin modification essentially only affects use of
osgconv.  What
it does is, if  the OutputTextureFiles option is turned on (such as
 by
passing
-O OutputTextureFiles to osgconv),


...or anytime OutputTextureFiles is present in the Options string.
 This
functionality is orthogonal to osgconv. Any application can access it
anytime they write a dot OSG file. This change will affect more than
 osgconv.

   -Paul


 Well, yes. In retrospect, I didn't name the patch very accurately given
 its
 contents - I created it while working on osgconv which is presumably why I
 mentioned osgconv in the name.

 In any case, we can consider it as a separate patch, to the .osg writer
 plugin.
 My intent was to make saving models with textures to OSG format work
 better.  In
 all of the following cases, insert the qualification with
 OutputTextureFiles
 enabled - behavior does not change unless this option is added. Before
 and
 after the patch, loading an .osg model in the place where it was initially
 saved
 works. After the patch, however, the textures go to a subdirectory named
 in a
 way that clearly links it with the model that uses it, and loading the
 saved
 model from another location as long as the textures were also copied/moved
 works
 correctly.  The only case I can see that worked before and won't work
 after, is
 if the .osg file alone is moved/copied somewhere else, but the textures
 remain
 in the originally-exported location. (This is due to the fact that it now
 exports relative paths.)

 As a useful side-effect (for privacy/security) of using relative paths,
 .osg
 files saved with this option turned on don't reveal details about the file
 organization of the computer they were saved on.

 Would this be an improvement that would better be separated into a
 distinct
 option string like OutputRelativeTextures or something like that?


 Yes, that's the way I'm leaning now. Your patch changes behavior, and would
 break any apps or utilities that depend on the current behavior. I'd be a
 lot more comfortable with this if it were a feature addition rather than a
 change to existing functionality.

 Do you think OutputRelativeTextures is a good name for it? If so, I can
 rewrite the submission locally (but you'll need to test it).

   -Paul


It makes sense to me, at least. Thanks!

Ryan

-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] QGLContext::makeCurrent(): Failed

2011-05-11 Thread Roni Zanolli
Hi All,

 I'm using the osgviewerQt example and I'd like the application to keep 60hz 
when I have 4 views. The default thread model SingleThreaded splits the speed 
between the 4 views. When I changed it to CullDrawThreadPerContext it works the 
way I want 60HZ. However I have a warning message QGLContext::makeCurrent(): 
Failed.
 Have anyone see this message and know how to fix it?


Cheers,
Roni

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





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


Re: [osg-users] OSG 2.8.5 stable release discussion

2011-05-11 Thread Paul Martz

Would this be an improvement that would better be separated into a 
distinct
option string like OutputRelativeTextures or something like that?


Yes, that's the way I'm leaning now. Your patch changes behavior, and would
break any apps or utilities that depend on the current behavior. I'd be a
lot more comfortable with this if it were a feature addition rather than a
change to existing functionality.

Do you think OutputRelativeTextures is a good name for it? If so, I can
rewrite the submission locally (but you'll need to test it).

   -Paul


It makes sense to me, at least. Thanks!


Okay, this is now in. Please test.

I've coded it so that if OutputRelativeTextures and OutputTextureFiles are both 
present, OutputRelativeTextures will take precedent.

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


Re: [osg-users] QGLContext::makeCurrent(): Failed

2011-05-11 Thread Wang Rui
Hi Roni,

It is a known issue of the osgviewerQt example under Linux. At present
I've no idea about the reason why Qt fails to make current in
multithreading modes.

Wang Rui


2011/5/12 Roni Zanolli r...@compro.net:
 Hi All,

  I'm using the osgviewerQt example and I'd like the application to keep 60hz 
 when I have 4 views. The default thread model SingleThreaded splits the speed 
 between the 4 views. When I changed it to CullDrawThreadPerContext it works 
 the way I want 60HZ. However I have a warning message 
 QGLContext::makeCurrent(): Failed.
  Have anyone see this message and know how to fix it?


 Cheers,
 Roni

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





 ___
 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] Fluctuations in frame rate for static scene

2011-05-11 Thread Ulrich Hertlein
On 12/05/11 8:10 , Kris Dale wrote:
 Alright, slight update:
 
 I am seeing the fluctuations in osgviewer as well, but anything I run that's 
 strictly
 OpenGL is steady.  Is this indicative of something being up with my OSG build 
 perhaps?
 I'm building against release libraries, I've already double checked that

Did you try running osgviewer single-threaded?  Multi-threading is over-kill 
for what
you're trying to achieve and might introduce such fluctuations...

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