Re: [osg-users] Multiple node and multiple transform

2015-03-16 Thread Robert Osfield
Hi Numan,

Have a look at the osganimation example.  This shows the loading of several
models and placing transforms above them.

Robert.

On 14 March 2015 at 23:25, Numan Kendir numankendi...@gmail.com wrote:

 Hi,
 I am new to OpenSceneGraph,
 I want to load multiple nodes and transform to their coordinates.
 My code looks like;


 Code:
 osg::Node* myNodes[10];

 osg::PositionAttitudeTransform * myXForm =new
 osg::PositionAttitudeTransform();

 for (row=0; row10; row++) {
 myNodes[row] = osgDB::readNodeFile(myobj.3ds);
 myXForm-setPosition( osg::Vec3d(x[row],y[row],0.0) );
 root-addChild(myXForm);
 myXForm-addChild(myNodes[row]);
 }




 i need an array like;
 myXForm[10]

 How can i do that?

 ...

 Thank you!

 Cheers,
 Numan

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





 ___
 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] Fwd: Last update in the osgAnimation::Animation ONCE mode bug fix

2015-03-16 Thread Robert Osfield
Hi KOS,

Thanks for the explanation and code change.  I had a look at your modified
AnimtkViewer.cpp but felt it was a bit long winded and awkward to follow
for what it implemented so used the following:

std::string playModeOpt;
if (arguments.read(--play-mode, playModeOpt))
{
osgAnimation::Animation::PlayMode playMode =
osgAnimation::Animation::LOOP;
if (osgDB::equalCaseInsensitive(playModeOpt, ONCE)) playMode
= osgAnimation::Animation::ONCE;
else if (osgDB::equalCaseInsensitive(playModeOpt, STAY))
playMode = osgAnimation::Animation::STAY;
else if (osgDB::equalCaseInsensitive(playModeOpt, LOOP))
playMode = osgAnimation::Animation::LOOP;
else if (osgDB::equalCaseInsensitive(playModeOpt, PPONG))
playMode = osgAnimation::Animation::PPONG;

for (osgAnimation::AnimationList::const_iterator animIter =
finder._am-getAnimationList().begin();
animIter != finder._am-getAnimationList().end();
++animIter)
{
(*animIter)-setPlayMode(playMode);
}
}

With this change (now checked into svn/trunk) then running:

  export OSG_RUN_MAX_FRAME_RATE=2
  osganimationviewer nathan.osg --play-mode ONCE

With this I'm able to reproduce the bug.

Robert.


On 15 March 2015 at 15:40, Konstantin lalakos...@gmail.com wrote:

 Hi, Robert!


 To see what happen, just run osganimationviewer with low FPS with patch
 and without it.

 *OSG_RUN_MAX_FRAME_RATE={2, 3 or 5} osganimationviewer* *--play-mode once*
 some_model_with_rig.osgb

 osganimationviewer's source with play-mode option in the attachment.


 Without patch, the last rendered picture (with different FPS) can be not
 the same.
 With patch, rendered picture is always the same no matter of FPS.


 KOS


 2015-03-13 20:33 GMT+04:00 Robert Osfield robert.osfi...@gmail.com:

 Hi Konstantin,

 On 13 March 2015 at 13:32, Konstantin lalakos...@gmail.com wrote:

 After Animation's update method *return false*,
 AnimationManager will remove this animation from the list of playing
 animations
 and will not call Animation's update method.


 No cpu overhead, i think :)


 I need to test this out to check what happens right now and with your
 patch, and whether there is a CPU overhead.

 What is the easiest way to recreate the problem you've seen?  Modifying
 an OSG example would probably be the most direct way.

 Cheers,
 Robert.


 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgOculusViewer and osg::Text

2015-03-16 Thread João
Thank you for the reply Robert, I have since solved the problem. I was using a 
2DOrtho projection using pixel coordinates to set up a layer upon which to 
render the text and using a matrix transform to  set it to an absolute 
referential, and it interacted weirdly with osgOculusViewer.Removing the 
2DOrtho projection and setting up the text on the 3D scene instead solved my 
problem.

Date: Mon, 16 Mar 2015 09:45:29 +
From: robert.osfi...@gmail.com
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] osgOculusViewer and osg::Text

Hi Joao,

I doubt other will be able to help as you provide too few details about what 
you are doing.  

Does the rest of the 3D scene work OK?

How you are managing your text and GUI?  Do you have transforms above them?  Is 
it a HUD?  Is in part of the 3D scene?

Robert.
On 14 March 2015 at 23:50, João joao.henrique.pi...@hotmail.com wrote:



I'm currently using osgOculusViewer in conjunction with osg::Text to try and 
create a GUI. Thing is, the text isn't being displayed as I'd expect.
The text appears to be mirrored.
  


  

___

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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Fwd: Last update in the osgAnimation::Animation ONCE mode bug fix

2015-03-16 Thread Robert Osfield
HI Konstantin,

I have experimented with you fix and tested whether it does add a CPU
overhead once the animation is complete, and found that your analysis is
correct, it both fixes the problem and update does keep getting called.  So
thumbs up ;-)

I have now checked in the fix to svn/trunk and OSG-3.2 branch.

Cheers
Robert.

On 16 March 2015 at 10:12, Robert Osfield robert.osfi...@gmail.com wrote:

 Hi KOS,

 Thanks for the explanation and code change.  I had a look at your modified
 AnimtkViewer.cpp but felt it was a bit long winded and awkward to follow
 for what it implemented so used the following:

 std::string playModeOpt;
 if (arguments.read(--play-mode, playModeOpt))
 {
 osgAnimation::Animation::PlayMode playMode =
 osgAnimation::Animation::LOOP;
 if (osgDB::equalCaseInsensitive(playModeOpt, ONCE)) playMode
 = osgAnimation::Animation::ONCE;
 else if (osgDB::equalCaseInsensitive(playModeOpt, STAY))
 playMode = osgAnimation::Animation::STAY;
 else if (osgDB::equalCaseInsensitive(playModeOpt, LOOP))
 playMode = osgAnimation::Animation::LOOP;
 else if (osgDB::equalCaseInsensitive(playModeOpt, PPONG))
 playMode = osgAnimation::Animation::PPONG;

 for (osgAnimation::AnimationList::const_iterator animIter =
 finder._am-getAnimationList().begin();
 animIter != finder._am-getAnimationList().end();
 ++animIter)
 {
 (*animIter)-setPlayMode(playMode);
 }
 }

 With this change (now checked into svn/trunk) then running:

   export OSG_RUN_MAX_FRAME_RATE=2
   osganimationviewer nathan.osg --play-mode ONCE

 With this I'm able to reproduce the bug.

 Robert.


 On 15 March 2015 at 15:40, Konstantin lalakos...@gmail.com wrote:

 Hi, Robert!


 To see what happen, just run osganimationviewer with low FPS with patch
 and without it.

 *OSG_RUN_MAX_FRAME_RATE={2, 3 or 5} osganimationviewer* *--play-mode
 once* some_model_with_rig.osgb

 osganimationviewer's source with play-mode option in the attachment.


 Without patch, the last rendered picture (with different FPS) can be not
 the same.
 With patch, rendered picture is always the same no matter of FPS.


 KOS


 2015-03-13 20:33 GMT+04:00 Robert Osfield robert.osfi...@gmail.com:

 Hi Konstantin,

 On 13 March 2015 at 13:32, Konstantin lalakos...@gmail.com wrote:

 After Animation's update method *return false*,
 AnimationManager will remove this animation from the list of playing
 animations
 and will not call Animation's update method.


 No cpu overhead, i think :)


 I need to test this out to check what happens right now and with your
 patch, and whether there is a CPU overhead.

 What is the easiest way to recreate the problem you've seen?  Modifying
 an OSG example would probably be the most direct way.

 Cheers,
 Robert.


 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Geometry vertices and nan/inf

2015-03-16 Thread Erik Hensens

robertosfield wrote:
 Your code is rather perverse and potentially unsafe way to get at the xyz 
 coords, but if the array is a Vec3Array then it should probably work OK.
 
 
 A better way to look at to coords is to cast the array to a Vec3Array and 
 access the vertices via the std::vector methods (Vec3Array subclasses from 
 std::vector) i.e.
 
 
   osg::Vec3Array* vertices  = 
 dynamic_castosg::Vec3Array*(geometry-getVertexArray());
   if (vetices)
   {
        for(unsigned int i=0; ivertices-size(); ++i)
        {
              osg::Vec3 vertex = (*vertices)[i];
              std::coutx=vertex.x(), y=vertex.y(), 
 vertex.z()std::endl;  
        }
   }
 
 
 Robert.
 


Hi Robert,

Thank you very much for your response. I don't understand how my code was 
potentially unsafe. Getting the type via pVertexArray-getType() returns 
Vec3ArrayType, shouldn't all Geometry vertex arrays be of this type?

As per my original question about non-real floating point coordinates, I 
believe I may be to blame; I might have accidentally set some non-real values 
as vertex x, y, and/or z values when building the Geometry in the first place. 
I am currently working on verifying whether or not this is so.

I suppose what surprised me was that OSG was able to draw the Geode that used 
the Geometry with the occasional nan/+inf/-inf vertex x/y/z parameter without 
any issues.

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





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


[osg-users] Create texture from texture handle

2015-03-16 Thread Steven Powers
HI!

Currently I have this texture getting generated by a plugin that I'm using:

glGenTextures(1, textureHandle);
glBindTexture(GL_TEXTURE_2D, textureHandle);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, N, M, 0, GL_RGB, GL_FLOAT, 
NULL);

Is there an easy way to create an osg::Texture2D to use the same texture 
handle? So far it looks like textures generate their own handles. I can't do 
away with the OpenGL code.

Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Compute shaders halt

2015-03-16 Thread Steven Powers
I've found a solution for this issue.

First, the compute node and result geometry must be assured to be in the same 
render bin.

2nd, attach the compute node program to a custom drawable node and turn off 
display lists so that is guaranteed to be executed every frame. 




Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Create texture from texture handle

2015-03-16 Thread Trajce Nikolov NICK
Hi Steven,

yes, you can wrap your GL texture handle with osg::Textire2D object. Here
is some snippet that might help:

snip
GLuint handle = ...;
osg::ref_ptrosg::Texture2D texture = new osg::Texture2D;
osg::ref_ptrosg::Texture::TextureObject textureObject = new
osg::Texture::TextureObject(texture.get(),handle,GL_TEXTURE_2D);
textureObject-setAllocated();


texture-setTextureObject(renderInfo.getContextID(),textureObject.get());

state.setActiveTextureUnit(textureStage);
texture-apply( state );

// Tell state about our changes
state.haveAppliedTextureAttribute(textureStage, texture.get());

On Mon, Mar 16, 2015 at 6:30 PM, Steven Powers stevenapow...@gmail.com
wrote:

 HI!

 Currently I have this texture getting generated by a plugin that I'm using:

 glGenTextures(1, textureHandle);
 glBindTexture(GL_TEXTURE_2D, textureHandle);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, N, M, 0, GL_RGB,
 GL_FLOAT, NULL);

 Is there an easy way to create an osg::Texture2D to use the same texture
 handle? So far it looks like textures generate their own handles. I can't
 do away with the OpenGL code.

 Thank you!

 Cheers,
 Steven

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





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




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


Re: [osg-users] Thoughts on Vulkan

2015-03-16 Thread Robert Osfield
On 16 March 2015 at 04:36, Chris Hanson xe...@alphapixel.com wrote:

 I'd be interested in seeing a draft of your white paper if you're willing
 to share.


I'm not far enough along with the writing it all down to share yet.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org