Re: [osg-users] osgText::Text::GlyphQuads change in the recent versions

2015-04-23 Thread Robert Osfield
Hi Nick,

On 22 April 2015 at 22:38, Trajce Nikolov NICK
 wrote:
> I did port of my app from 3.3.1 to the latest 3.3.7. All went smooth only
> one line of code I want to #ifdef with OSG_VERSION due to the apps still
> depend on 3.3.1. And this is the usage of ref_ptrs in GlyphQuads
> coordiantes. Can you recall from which version they becomed ref_ptrs of
> Arrays? It will save me time to go across the code of each version from
> 3.3.1

I don't recall the timing of this change.  Have a look at the svn log
for the file and then compare that to the dates of the dev releases.

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


Re: [osg-users] attribute variable transfers error

2015-04-23 Thread Robert Osfield
Hi Allan,

On 23 April 2015 at 02:44, allan xia  wrote:
> I am sorry I did not describe the solution clearly.
> Now I need to do some extra operations in the models,so I must use shaders
> .And different models have little different operations,but mostly same
> operations, So I use the same shaders and send a flag variable to the
> shaders to judge which model the vertexs belong to. then I could solve the
> different operations. and now I use the nodevisitor to judge which model the
> vertex belongs to ,but I occur error.
> Actually the problem I need to solve is:
> how the judge which model the vertex belongs to in the vertex shaders and
> fragment shaders?

What do you mean by models in this context?

What have the vertex position have to do with the "models"?

Normally with scene graph usage a "model" would represent something
like a car, a house, or a whole town etc, and would be loaded/created
as a subgraph that gets added to the overall scene.  With each of
these subgraphs you can attach a StateSet to the topmost of node of
the subgrah, and have thes StateSet provide a specific Uniform value
that can control shaders.

Whether this is at all appropriate in your case I cannot say as I
can't work out what you might mean.

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


Re: [osg-users] osgText::Text::GlyphQuads change in the recent versions

2015-04-23 Thread Trajce Nikolov NICK
Thanks Robert :-)

On Thu, Apr 23, 2015 at 10:32 AM, Robert Osfield 
wrote:

> Hi Nick,
>
> On 22 April 2015 at 22:38, Trajce Nikolov NICK
>  wrote:
> > I did port of my app from 3.3.1 to the latest 3.3.7. All went smooth only
> > one line of code I want to #ifdef with OSG_VERSION due to the apps still
> > depend on 3.3.1. And this is the usage of ref_ptrs in GlyphQuads
> > coordiantes. Can you recall from which version they becomed ref_ptrs of
> > Arrays? It will save me time to go across the code of each version from
> > 3.3.1
>
> I don't recall the timing of this change.  Have a look at the svn log
> for the file and then compare that to the dates of the dev releases.
>
> Robert.
> ___
> 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] Android osgPlugins

2015-04-23 Thread Christian Kehl
Rafa Gaitan  writes:

> 
> 
> Hello Christian, 
> Just to clarify a little bit the things:
> 
> - All the versions until 3.3.2 (I think that's the last one), should be
compiled using the old system (generating the Android.mk files through cmake)
> 
> - Newer version must use the new Toolchain mechanism
> 
> Both methods are explained
here: 
http://www.openscenegraph.org/index.php/documentation/platform-specifics/android
> 
> 
> Regarding the examples inside OSG, I don't know the current status, as far
as I know Jordi made them work but I usually use osgAndroid. FYI I changed
the repository of osgAndroid to github, seems that gitorious has been
absorbed by gitlab, so I moved it out. The new url
is: https://github.com/corsario/osgAndroid
> 
> 
> Regarding the thirdparty dependencies with the new Toolchain, you are
right, is something I forgot to add into cmake when I was cleaning it up for
building for Android. I'll try to do it once I had some time.
> 
> On the other hand, you must build OSG either GLES1 or GLES2. If you build
it against GLES2 then you need to add your own shaders to see something on
screen, of course the example for GLES2 won't work if OSG was built with
GLES1 and the GLES1 example won't show anything if OSG was compiled with
GLES2, I apologize if this was already clarified :)
> 
> Best regards,
> Rafa.
> 
> 
> 



Then how do I use the toolchain file for compiling examples that are 
imported in Eclipse ? I don't fully understand the toolchain 
mechanism further than basically compiling the libraries 
(which went successfull so far).
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Android osgPlugins

2015-04-23 Thread Jordi Torres
Hi Christian


> Then how do I use the toolchain file for compiling examples that are
> imported in Eclipse ? I don't fully understand the toolchain
> mechanism further than basically compiling the libraries
> (which went successfull so far).
>
>
The toolchain stuff is only to compile the libraries. I will test from
scratch, maybe I'm missing something, and my eclipse projects were created
time ago.

Cheers.

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


Re: [osg-users] osgText::Text::GlyphQuads change in the recent versions

2015-04-23 Thread Trajce Nikolov NICK
It was introduced in 3.3.4 .. just as an info if someone 

Nick

On Thu, Apr 23, 2015 at 11:40 AM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Thanks Robert :-)
>
> On Thu, Apr 23, 2015 at 10:32 AM, Robert Osfield  > wrote:
>
>> Hi Nick,
>>
>> On 22 April 2015 at 22:38, Trajce Nikolov NICK
>>  wrote:
>> > I did port of my app from 3.3.1 to the latest 3.3.7. All went smooth
>> only
>> > one line of code I want to #ifdef with OSG_VERSION due to the apps still
>> > depend on 3.3.1. And this is the usage of ref_ptrs in GlyphQuads
>> > coordiantes. Can you recall from which version they becomed ref_ptrs of
>> > Arrays? It will save me time to go across the code of each version from
>> > 3.3.1
>>
>> I don't recall the timing of this change.  Have a look at the svn log
>> for the file and then compare that to the dates of the dev releases.
>>
>> Robert.
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
>
> --
> trajce nikolov nick
>



-- 
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] AnimationPath + AnimationPathCallback

2015-04-23 Thread Georg Gast
I forgot to mention: 

I use openscenegraph 3.2.1 on Linux.

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





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


[osg-users] AnimationPath + AnimationPathCallback

2015-04-23 Thread Georg Gast
Hi,

right now i try to move to different objects in my scene. I attached a own 
AnimamationPathCallback to 2 MatrixTransform Nodes in my scene.

My goal is, that both nodes move independently but each should notify me, when 
it animation is finished.

Here is my callback

Code:

// create the update callback
struct Notify : osg::AnimationPathCallback
{
Notify(osg::AnimationPath* p, bool& animation_done)
: osg::AnimationPathCallback(p) , m_animation_done(animation_done) {}

virtual void operator()(osg::Node*  node,
osg::NodeVisitor*  nv)
{
osg::AnimationPathCallback::operator()(node,nv);
if (m_animation_done)
return;

osg::MatrixTransform* p_mt =
dynamic_cast(node);
if (p_mt)
{
auto p_down = dynamic_cast(p_mt->getUpdateCallback());
if (p_down == this)
{
auto p_path = getAnimationPath();
double current_time = getAnimationTime();
double max_time = p_path->getLastTime();

if (current_time >= max_time)
{
m_animation_done = true;
}
}
}
}

bool& m_animation_done;
};




This callback works when only one is attached to a node in the scene. When i 
attach two of them, with different animation path, just the one of them gets 
updated. In fact, i bought both OpenSceneGraph Books, but i could not find a 
hint why this should not happen.

This way i start the animations 


Code:

void update_controller::start_animation(const std::vector& animation, 
bool& animation_done)
{
animation_done = false;

osg::ref_ptr p_path =
new osg::AnimationPath;

// only one shot
p_path->setLoopMode(osg::AnimationPath::NO_LOOPING);

// define the control points
assert(animation.size() >= 2);
static const osg::Vec3 delta_z( 0, 0, 1 );

size_t p = 0; float time = 0.0f;
osg::AnimationPath::ControlPoint cp(m_all_pos[animation[p]]);
p_path->insert(time, cp); time+= 0.1f;

cp = osg::AnimationPath::ControlPoint(m_all_pos[animation[p]] - delta_z);
p_path->insert(time, cp); time+= 0.1f;
p++;
assert(p == 1);

while (p < animation.size()-1)
{
cp = osg::AnimationPath::ControlPoint(m_all_pos[animation[p]] - 
delta_z);
p_path->insert(time, cp); time+= 0.1f;
p++;
}

cp = osg::AnimationPath::ControlPoint(m_all_pos[animation[p]]);
p_path->insert(time, cp); time+= 0.1f;

osg::ref_ptr p_animation_cb =
new Notify(p_path.get(), animation_done );

// set this callback to the desired pins matrix
assert(m_id_player_pin != -1);
assert(m_pins[m_id_player_pin] != nullptr);
m_pins[m_id_player_pin]->setUpdateCallback(p_animation_cb.get());
}




I guess, it is just a small thing. This is my first OSG project and in fact it 
is my first problem, which i cant solve by reading the books  :(

Thank you!

Cheers,
Georg

P.S.: I dont know why the forum shows my "4 space tabs" as ??? I replaced my 
"\t" by four spaces in my editor   :?

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





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


Re: [osg-users] AnimationPath + AnimationPathCallback

2015-04-23 Thread Georg Gast
Hi,

i got it! [Idea]  ... I attached both callbacks to the same node. *DOH*

Sorry for the noise 

Thank you!

Cheers,
Georg

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





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


Re: [osg-users] Android osgPlugins

2015-04-23 Thread Christian Kehl
Christian Kehl  writes:

> 
> Rafa Gaitan  ...> writes:
> 

Hi Hi,

so, I downloaded osgAndroid, imported the projects into my Eclipse. I 
like this more elegant way of jni-wrapping - comes close to what I've 
seen in OpenCV when compiling it for mobile.

Then, I needed to rebuild the OpenSceneGraph 3.3.7, because 
osgAndroid's README.md says "only working with GLES 1.1 builds". 
okay, said - executed. I get the following errors already common 
to me when building OSG GLES 1.1:

Linking CXX static library ../../../lib/libOpenThreads.a
[  0%] Built target OpenThreads
[  0%] Building CXX object src/osg/CMakeFiles/osg.dir/AlphaFunc.cpp.o
In file included from
/media/christian/DATA/OpenSceneGraph337/include/osg/GLDefines:25:0,
 from
/media/christian/DATA/OpenSceneGraph337/include/osg/GLExtensions:18,
 from
/media/christian/DATA/OpenSceneGraph337/include/osg/Shader:25,
 from
/media/christian/DATA/OpenSceneGraph337/include/osg/StateAttribute:20,
 from
/media/christian/DATA/OpenSceneGraph337/include/osg/AlphaFunc:17,
 from
/media/christian/DATA/OpenSceneGraph337/src/osg/AlphaFunc.cpp:14:
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL: In function
'void glLoadMatrix(const float*)':
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:130:96: error:
'glLoadMatrixf' was not declared in this scope
 inline void glLoadMatrix(const float* mat) {
glLoadMatrixf(static_cast(mat)); }
   
^
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL: In function
'void glMultMatrix(const float*)':
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:131:96: error:
'glMultMatrixf' was not declared in this scope
 inline void glMultMatrix(const float* mat) {
glMultMatrixf(static_cast(mat)); }
   
^
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL: In function
'void glLoadMatrix(const double*)':
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:149:87: error:
ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
 inline void glLoadMatrix(const double* mat) {
glLoadMatrixd(static_cast(mat)); }
   
   ^
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:149:87: error:
expected '>' before 'GLdouble'
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:149:87: error:
expected '(' before 'GLdouble'
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:149:87: error:
'GLdouble' was not declared in this scope
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:149:96: error:
expected primary-expression before '>' token
 inline void glLoadMatrix(const double* mat) {
glLoadMatrixd(static_cast(mat)); }
   
^
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL: In function
'void glMultMatrix(const double*)':
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:150:87: error:
ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
 inline void glMultMatrix(const double* mat) {
glMultMatrixd(static_cast(mat)); }
   
   ^
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:150:87: error:
expected '>' before 'GLdouble'
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:150:87: error:
expected '(' before 'GLdouble'
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:150:87: error:
'GLdouble' was not declared in this scope
/media/christian/DATA/OpenSceneGraph337/build/include/osg/GL:150:96: error:
expected primary-expression before '>' token
 inline void glMultMatrix(const double* mat) {
glMultMatrixd(static_cast(mat)); }
   
^
/media/christian/DATA/OpenSceneGraph337/src/osg/AlphaFunc.cpp: In member
function 'virtual void osg::AlphaFunc::apply(osg::State&) const':
/media/christian/DATA/OpenSceneGraph337/src/osg/AlphaFunc.cpp:33:56: error:
'glAlphaFunc' was not declared in this scope
 glAlphaFunc((GLenum)_comparisonFunc,_referenceValue);
^
src/osg/CMakeFiles/osg.dir/build.make:57: recipe for target
'src/osg/CMakeFiles/osg.dir/AlphaFunc.cpp.o' failed
make[2]: *** [src/osg/CMakeFiles/osg.dir/AlphaFunc.cpp.o] Error 1
CMakeFiles/Makefile2:249: recipe for target 'src/osg/CMakeFiles/osg.dir/all'
failed
make[1]: *** [src/osg/CMakeFiles/osg.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2

just switching the -DOPENGL_PROFILE flag to GLES2 did have no effect 
on t