[osg-users] attribute variable transfers error

2015-04-22 Thread allan xia
 I need to distinguish the vertexs in different models in vertex shaders
and fragment shaders  .so I use a nodevisitor to transfer a attribute
variable to the vertex shaders.as follows:
I transfer different value to the vertex  shader if the type is dedined
different.

class AnalysisNodeVisitor :public osg::NodeVisitor{
public:
AnalysisNodeVisitor(INPUTTYPE
type):osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN){
m_InputType=type;
}
virtual void apply(osg::Geode &node)
{
for ( unsigned int i=0; i(node.getDrawable(i) );
if ( geom ){
osg::FloatArray *fa=new osg::FloatArray;
switch(m_InputType){
case INPUTTEXTURE:
{
fa->push_back(0.1);
break;
}
case INPUTMATERIAL:
{
fa->push_back(0.2);
break;
}
default :
{
fa->push_back(0.9);
}
}
geom->setVertexAttribArray(6,fa);
geom->setVertexAttribBinding(6,osg::Geometry::BIND_OVERALL);
}
}
traverse( node );
}
virtual void apply(osg::Node &node){
traverse(node);
}
public:
INPUTTYPE m_InputType;
};

and bind the attribute to the shader:
program->addBindAttribLocation("modelType",6);

but when I use the AnalysisNodeVisitor,I occur a error.

AnalysisNodeVisitor anvA(INPUTTEXTURE);
nodeA.accept(anvA);
AnalysisNodeVisitor anvB(INPUTMATERIAL);
nodeB.accept(anvB);

and in the vertex shader  modelType variable of vertexs in nodeA should be
0.1 and modeType variable of vertexs in NodeB should be 0.2 ,but actually
modeType variable of all vertex is 0.2 .It  seems
nodeB.accept(anvB) override the modeType variable of nodeA. what is wrong
with it?Am I misunderstand it ?
___
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-22 Thread Robert Osfield
Hi Allan,

Could you take a step back and tells us what problem you are trying to
solve as you've dived in with a rather perplexing implementation for a
problem that may well have a very straight forward solution.

Robert.

On 22 April 2015 at 10:34, allan xia  wrote:
>  I need to distinguish the vertexs in different models in vertex shaders and
> fragment shaders  .so I use a nodevisitor to transfer a attribute variable
> to the vertex shaders.as follows:
> I transfer different value to the vertex  shader if the type is dedined
> different.
>
> class AnalysisNodeVisitor :public osg::NodeVisitor{
> public:
> AnalysisNodeVisitor(INPUTTYPE
> type):osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN){
> m_InputType=type;
> }
> virtual void apply(osg::Geode &node)
> {
> for ( unsigned int i=0; i {
> osg::Geometry* geom = dynamic_cast(node.getDrawable(i) );
> if ( geom ){
> osg::FloatArray *fa=new osg::FloatArray;
> switch(m_InputType){
> case INPUTTEXTURE:
> {
> fa->push_back(0.1);
> break;
> }
> case INPUTMATERIAL:
> {
> fa->push_back(0.2);
> break;
> }
> default :
> {
> fa->push_back(0.9);
> }
> }
> geom->setVertexAttribArray(6,fa);
> geom->setVertexAttribBinding(6,osg::Geometry::BIND_OVERALL);
> }
> }
> traverse( node );
> }
> virtual void apply(osg::Node &node){
> traverse(node);
> }
> public:
> INPUTTYPE m_InputType;
> };
>
> and bind the attribute to the shader:
> program->addBindAttribLocation("modelType",6);
>
> but when I use the AnalysisNodeVisitor,I occur a error.
>
> AnalysisNodeVisitor anvA(INPUTTEXTURE);
> nodeA.accept(anvA);
> AnalysisNodeVisitor anvB(INPUTMATERIAL);
> nodeB.accept(anvB);
>
> and in the vertex shader  modelType variable of vertexs in nodeA should be
> 0.1 and modeType variable of vertexs in NodeB should be 0.2 ,but actually
> modeType variable of all vertex is 0.2 .It seems nodeB.accept(anvB) override
> the modeType variable of nodeA. what is wrong with it?Am I misunderstand it
> ?
>
> ___
> 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] Android osgPlugins

2015-04-22 Thread Christian Kehl
Jordi Torres  writes:

> 
> 
> Hi Christian, 
> I just compiled OSG for Android and executed the example with the fresh
build for GLES1 without major problems. 
> What version of OSG are you running? Does the example shipped with OSG
works for you? Are you compiling using the toolchain?
> 
>  
> 
> 
> 
> 2015-04-20 10:58 GMT+02:00 Jordi Torres
:
> Hi Christian, Jan et al.
> Sorry for not being too active Anyway, did you try to compile all with
the last additions from Rafa Gaitán? Now it is possible to compile OSG for
Android with dynamic libraries, take a look
to 
http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4
.
> Is a must for you to use static libs? You can try the dynamic version,
maybe it solves your problems.
> 
> Also we are using osgAndroid ( https://gitorious.org/osgandroid/pages/Home
) maybe it could be helpful. 
> 
> I'm building now OSG for Android to do some testing. 
> 
> I hope I can help a bit later. 
> 
> 
> 
> 
> Do the osgAndroid examples shipped with OSG work for you? If those don't
work neither, then something has changed in OSG and broke it since mid-2013
when I have last compiled the Android version (and when it was working). 
> 
> J.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ___

Hi to everybody,

it's comforting to see some activity going on. The last days, I was working
on another project, so please excuse my late reply too.

I am using OpenSceneGraph 3.0.1. The GLES1 and GLES2 example shipped with
android are the ones that break (not load data). It's not a must-have for me
to use static linking - if dynamic linking would work, it would be fine for
me too. At the moment, I just like to see some model on my android :-)

I will try out osgAndroid and the 3.0.4 build - let's hope it resolves the
issue. Jordi - which version of the NDK are you using ? I have the r10 NDK
installed. It may be good to know for tracking down the error.

News are about to be reported soon. Best Regards,

Christian


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


[osg-users] [osgPlugins] Using SDL plugin

2015-04-22 Thread Leandro Linardos
Hi,

I'm trying to control my camera with a Joystick using the SDL plugin, but I 
think I'm missing something.

The instance of a JoystickDevice comes from osgDB, when we read for a file with 
name "joystick.sdl". But, how I can add new key mappings if I can't include the 
JoystickDevice type (all plugin's files are in src)?

Thank you!

Cheers,
Leandro

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





___
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-22 Thread Jordi Torres
Hi,


> I am using OpenSceneGraph 3.0.1. The GLES1 and GLES2 example shipped with
> android are the ones that break (not load data).


What instructions did you follow to compile? Did you use the toolchain?


> It's not a must-have for me
> to use static linking - if dynamic linking would work, it would be fine for
> me too. At the moment, I just like to see some model on my android :-)

I will try out osgAndroid and the 3.0.4 build - let's hope it resolves the
> issue.


Be careful I mean *3.3.x-3.4, not 3.0.4* -->
http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4


> Jordi - which version of the NDK are you using ? I have the r10 NDK
> installed. It may be good to know for tracking down the error.
>
>
I used ndk -r8e, I will try latest ndk when I have the time.


> News are about to be reported soon. Best Regards,
>
> Christian
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


Cheers.

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


[osg-users] Orthographic projection and LOD nodes

2015-04-22 Thread Mike Connell
Hi!

I have a problem viewing a PagedLOD terrain database together with a
top-down bird's eye orthographic projection.

Since the tiles furthest from the center of the screen are further from the
eye point, they are rendered at a lower LOD level (the database uses the
DISTANCE_FROM_EYE_POINT RangeMode). What I would like to achieve is a
constant LOD scale across the entire view for a given ortho zoom level /
"height".

Has anyone come across - and solved this problem before?

My idea so far involves fiddling with the CullVisitor - basically
counteracting the effect of the distance to eyepoint calculation by
modifying the LOD bias in the opposite direction. I am not 100% sure this
is feasible, or necessary, or ideal.

Is there a simpler solution?

Thanks!

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


Re: [osg-users] Orthographic projection and LOD nodes

2015-04-22 Thread Robert Osfield
Hi Mike,

Traditional LOD's are selected on distance range, which makes sense
for perspective projection, but for orthographic it doesn't make
sense.  Choosing LOD based on screen space would be appropriate for
orthographic projection.  I haven't personally tried it with PagedLOD
but in theory it should work.  It will require you to modify the
PagedLOD's on loading if they aren't set up for screen space
selection, as osgDB::ReadFileCallback could be used to process the
newly loading subgraphs.

Robert.

On 22 April 2015 at 14:12, Mike Connell  wrote:
> Hi!
>
> I have a problem viewing a PagedLOD terrain database together with a
> top-down bird's eye orthographic projection.
>
> Since the tiles furthest from the center of the screen are further from the
> eye point, they are rendered at a lower LOD level (the database uses the
> DISTANCE_FROM_EYE_POINT RangeMode). What I would like to achieve is a
> constant LOD scale across the entire view for a given ortho zoom level /
> "height".
>
> Has anyone come across - and solved this problem before?
>
> My idea so far involves fiddling with the CullVisitor - basically
> counteracting the effect of the distance to eyepoint calculation by
> modifying the LOD bias in the opposite direction. I am not 100% sure this is
> feasible, or necessary, or ideal.
>
> Is there a simpler solution?
>
> Thanks!
>
> Mike
>
>
>
> ___
> 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] Multiple color layers for an osgTerrain::TerrainTile

2015-04-22 Thread Leandro Linardos
Hi,

I'm working with terrain data in a quad-tree structure at differents LODs. 

I want to show elevation data at LOD A and imagery data at level A+1, so, there 
are 4 color layers and 1 heightfield layer. I set the locators in each layer, 
so each one is well located. Each color layer (with the imagery data) covers 
only a quarter of the tile, fulfilling the remaing three quartes with black (in 
fact it depends on the wrap mode of the texture). Each tile quarter is composed 
with three black color areas and one imagery data area. 

In this scenary, the problem is that the imagery data is lost when are joined 
with the black area of the others layers. The result is black color painting 
all the tile.

Is there a way to fulfill the remaining of a layer with transparent color 
instead of black? Another ideas? Maybe there is something I'm not seeing.

(I get it working composing the 4 imagery images in one with the double of 
width and height, or adding the alpha 0 quartes directly in the source image 
getting 4 images with the double of width and height, but I would want use the 
data sources as they are, without preprocessing).

Thank you!

Cheers,
Leandro

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





___
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-22 Thread Jordi Torres
Hi Christian,

I just compiled with ndk r10d, I used the gnustl_static from
($NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a

It works so far.

2015-04-22 13:51 GMT+02:00 Jordi Torres :

> Hi,
>
>
>> I am using OpenSceneGraph 3.0.1. The GLES1 and GLES2 example shipped with
>> android are the ones that break (not load data).
>
>
> What instructions did you follow to compile? Did you use the toolchain?
>
>
>> It's not a must-have for me
>> to use static linking - if dynamic linking would work, it would be fine
>> for
>> me too. At the moment, I just like to see some model on my android :-)
>
> I will try out osgAndroid and the 3.0.4 build - let's hope it resolves the
>> issue.
>
>
> Be careful I mean *3.3.x-3.4, not 3.0.4* -->
> http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4
>
>
>> Jordi - which version of the NDK are you using ? I have the r10 NDK
>> installed. It may be good to know for tracking down the error.
>>
>>
> I used ndk -r8e, I will try latest ndk when I have the time.
>
>
>> News are about to be reported soon. Best Regards,
>>
>> Christian
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
> Cheers.
>
> --
> Jordi Torres
>
>
>


-- 
Jordi Torres
___
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-22 Thread Christian Kehl
Christian Kehl  writes:

> 
> Jordi Torres  ...> writes:
> 
> > 
> > 
> > Hi Christian, 
> > I just compiled OSG for Android and executed the example with the fresh
> build for GLES1 without major problems. 
> > What version of OSG are you running? Does the example shipped with OSG
> works for you? Are you compiling using the toolchain?
> > 
> >  
> > 
> > 
> > 
> > 2015-04-20 10:58 GMT+02:00 Jordi Torres
> :
> > Hi Christian, Jan et al.
> > Sorry for not being too active Anyway, did you try to compile all with
> the last additions from Rafa Gaitán? Now it is possible to compile OSG for
> Android with dynamic libraries, take a look
>
to 
http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4
> .
> > Is a must for you to use static libs? You can try the dynamic version,
> maybe it solves your problems.
> > 
> > Also we are using osgAndroid ( https://gitorious.org/osgandroid/pages/Home
> ) maybe it could be helpful. 
> > 
> > I'm building now OSG for Android to do some testing. 
> > 
> > I hope I can help a bit later. 
> > 
> > 
> > 
> > 
> > Do the osgAndroid examples shipped with OSG work for you? If those don't
> work neither, then something has changed in OSG and broke it since mid-2013
> when I have last compiled the Android version (and when it was working). 
> > 
> > J.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ___
> 
> Hi to everybody,
> 
> it's comforting to see some activity going on. The last days, I was working
> on another project, so please excuse my late reply too.
> 
> I am using OpenSceneGraph 3.0.1. The GLES1 and GLES2 example shipped with
> android are the ones that break (not load data). It's not a must-have for me
> to use static linking - if dynamic linking would work, it would be fine for
> me too. At the moment, I just like to see some model on my android 
> 
> I will try out osgAndroid and the 3.0.4 build - let's hope it resolves the
> issue. Jordi - which version of the NDK are you using ? I have the r10 NDK
> installed. It may be good to know for tracking down the error.
> 
> News are about to be reported soon. Best Regards,
> 
> Christian
> 
> ___
> osg-users mailing list
> osg-users  lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 

So, I downloaded the 3.3.7 developer version of OpenSceneGraph and ran the 
cmake command as given in the link for "Building OpenSceneGraph 3.3.2-3.4.x 
for Android" (sth. like it).

After a bit of hassle, it compiled fine. 
I also put the 3rdParty folder inside the OSG root folder, but cmake reported 
that CURL, Jpeg, Tiff etc. are missing - well, weird, but not urgent for now.
I use the svn version rc2, and compile with OPENGL_PROFILE "GLES2".

Then, I imported the GLES1/2 examples in Eclipse, modified the Android.mk so
to link to the installation folder (btw: still used static libs) and using
gnustl_static, ran ndk-build, and this is the output:

christian@PROMETHEUS:~/workspace/Android/osgViewerGLES1_337$
${ANDROID_NDK}/ndk-build
Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries 
in linker flags:
-lgnustl_static -lcurl -ljpeg -lgif -lpng -ltiff -losgdb_dds
-losgdb_openflight -losgdb_tga -losgdb_rgb -losgdb_osgterrain -losgdb_osg
-losgdb_ive -losgdb_deprecated_osgviewer -losgdb_deprecated_osgvolume
-losgdb_deprecated_osgtext -losgdb_deprecated_osgterrain
-losgdb_deprecated_osgsim -losgdb_deprecated_osgshadow
-losgdb_deprecated_osgparticle -losgdb_deprecated_osgfx
-losgdb_deprecated_osganimation -losgdb_deprecated_osg
-losgdb_serializers_osgvolume -losgdb_serializers_osgtext
-losgdb_serializers_osgterrain -losgdb_serializers_osgsim
-losgdb_serializers_osgshadow -losgdb_serializers_osgparticle
-losgdb_serializers_osgmanipulator -losgdb_serializers_osgfx
-losgdb_serializers_osganimation -losgdb_serializers_osg -losgViewer
-losgVolume -losgTerrain -losgText -losgShadow -losgSim -losgParticle
-losgManipulator -losgGA -losgFX -losgDB -losgAnimation -losgUtil -losg
-lOpenThreads
Android NDK: This is likely to result in incorrect builds. Try using
LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library
dependencies of the
Android NDK: current module
Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries in
linker flags: -lgnustl_static -lcurl -ljpeg -lgif -lpng -ltiff -losgdb_dds
-losgdb_openflight -losgdb_tga -losgdb_rgb -losgdb_osgterrain -losgdb_osg
-losgdb_ive -losgdb_deprecated_osgviewer -losgdb_deprecated_osgvolume
-losgdb_deprecated_osgtext -losgdb_deprecated_osgterrain
-losgdb_deprecated_osgsim -losgdb_deprecated_osgshadow
-losgdb_deprecated_osgparticle -losgdb_deprecated_osgfx
-losgdb_deprecated_osganimation -losgdb_deprecated_osg
-losgdb_serializers_osgvolume -losgdb_serializers_osgtext
-losgdb_serializers_osgterrain -losgdb_seri

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

2015-04-22 Thread Trajce Nikolov NICK
Hi Robert,

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

Thanks a lot as always

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] Android osgPlugins

2015-04-22 Thread Rafa Gaitan
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.


2015-04-22 21:59 GMT+02:00 Christian Kehl :

> Christian Kehl  writes:
>
> >
> > Jordi Torres  ...> writes:
> >
> > >
> > >
> > > Hi Christian,
> > > I just compiled OSG for Android and executed the example with the fresh
> > build for GLES1 without major problems.
> > > What version of OSG are you running? Does the example shipped with OSG
> > works for you? Are you compiling using the toolchain?
> > >
> > >
> > >
> > >
> > >
> > > 2015-04-20 10:58 GMT+02:00 Jordi Torres
> > :
> > > Hi Christian, Jan et al.
> > > Sorry for not being too active Anyway, did you try to compile all
> with
> > the last additions from Rafa Gaitán? Now it is possible to compile OSG
> for
> > Android with dynamic libraries, take a look
> >
> to
> http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4
> > .
> > > Is a must for you to use static libs? You can try the dynamic version,
> > maybe it solves your problems.
> > >
> > > Also we are using osgAndroid (
> https://gitorious.org/osgandroid/pages/Home
> > ) maybe it could be helpful.
> > >
> > > I'm building now OSG for Android to do some testing.
> > >
> > > I hope I can help a bit later.
> > >
> > >
> > >
> > >
> > > Do the osgAndroid examples shipped with OSG work for you? If those
> don't
> > work neither, then something has changed in OSG and broke it since
> mid-2013
> > when I have last compiled the Android version (and when it was working).
> > >
> > > J.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ___
> >
> > Hi to everybody,
> >
> > it's comforting to see some activity going on. The last days, I was
> working
> > on another project, so please excuse my late reply too.
> >
> > I am using OpenSceneGraph 3.0.1. The GLES1 and GLES2 example shipped with
> > android are the ones that break (not load data). It's not a must-have
> for me
> > to use static linking - if dynamic linking would work, it would be fine
> for
> > me too. At the moment, I just like to see some model on my android
> >
> > I will try out osgAndroid and the 3.0.4 build - let's hope it resolves
> the
> > issue. Jordi - which version of the NDK are you using ? I have the r10
> NDK
> > installed. It may be good to know for tracking down the error.
> >
> > News are about to be reported soon. Best Regards,
> >
> > Christian
> >
> > ___
> > osg-users mailing list
> > osg-users  lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
> So, I downloaded the 3.3.7 developer version of OpenSceneGraph and ran the
> cmake command as given in the link for "Building OpenSceneGraph 3.3.2-3.4.x
> for Android" (sth. like it).
>
> After a bit of hassle, it compiled fine.
> I also put the 3rdParty folder inside the OSG root folder, but cmake
> reported
> that CURL, Jpeg, Tiff etc. are missing - well, weird, but not urgent for
> now.
> I use the svn version rc2, and compile with OPENGL_PROFILE "GLES2".
>
> Then, I imported the GLES1/2 examples in Eclipse, modified the Android.mk
> so
> to link to the installation folder (btw: still used static libs) and using
> gnustl_static, ran ndk-build, and this is the output:
>
> christian@PROMETHEUS:~/workspace/Android/osgViewerGLES1_337$
> ${ANDROID_NDK}/ndk-build
> Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries
> in linker flags:
> -lgnustl_static -lcurl -ljpeg -lgif -lpng -ltiff -losgdb_dds
> -losgdb_openflight -losgdb_tga -losgdb_rgb -losgdb_osgterrain -losgdb_osg
> -losgdb_ive -losgdb_deprecated_osgviewer -losgdb_deprecated_osgvolume
> -losgdb_deprecated_osgtext -losgdb_depreca

Re: [osg-users] attribute variable transfers error

2015-04-22 Thread allan xia
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?

thanks

Date: Wed, 22 Apr 2015 10:58:35 +0100
From: Robert Osfield 
To: OpenSceneGraph Users 
Subject: Re: [osg-users] attribute variable transfers error
Message-ID:

Content-Type: text/plain; charset=ISO-8859-1

Hi Allan,

Could you take a step back and tells us what problem you are trying to
solve as you've dived in with a rather perplexing implementation for a
problem that may well have a very straight forward solution.

Robert.

On 22 April 2015 at 10:34, allan xia  wrote:
>  I need to distinguish the vertexs in different models in vertex shaders
and
> fragment shaders  .so I use a nodevisitor to transfer a attribute variable
> to the vertex shaders.as follows:
> I transfer different value to the vertex  shader if the type is defined
> different.
>
> class AnalysisNodeVisitor :public osg::NodeVisitor{
> public:
> AnalysisNodeVisitor(INPUTTYPE
> type):osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN){
> m_InputType=type;
> }
> virtual void apply(osg::Geode &node)
> {
> for ( unsigned int i=0; i {
> osg::Geometry* geom = dynamic_cast(node.getDrawable(i) );
> if ( geom ){
> osg::FloatArray *fa=new osg::FloatArray;
> switch(m_InputType){
> case INPUTTEXTURE:
> {
> fa->push_back(0.1);
> break;
> }
> case INPUTMATERIAL:
> {
> fa->push_back(0.2);
> break;
> }
> default :
> {
> fa->push_back(0.9);
> }
> }
> geom->setVertexAttribArray(6,fa);
> geom->setVertexAttribBinding(6,osg::Geometry::BIND_OVERALL);
> }
> }
> traverse( node );
> }
> virtual void apply(osg::Node &node){
> traverse(node);
> }
> public:
> INPUTTYPE m_InputType;
> };
>
> and bind the attribute to the shader:
> program->addBindAttribLocation("modelType",6);
>
> but when I use the AnalysisNodeVisitor,I occur a error.
>
> AnalysisNodeVisitor anvA(INPUTTEXTURE);
> nodeA.accept(anvA);
> AnalysisNodeVisitor anvB(INPUTMATERIAL);
> nodeB.accept(anvB);
>
> and in the vertex shader  modelType variable of vertexs in nodeA should be
> 0.1 and modeType variable of vertexs in NodeB should be 0.2 ,but actually
> modeType variable of all vertex is 0.2 .It seems nodeB.accept(anvB)
override
> the modeType variable of nodeA. what is wrong with it?Am I misunderstand
it
> ?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org