Re: [osg-users] colours in Android OSG

2012-04-25 Thread Maurizio Lodo
Hi Jorge and thanks for your reply.
The file I am loading in the viewers is cell.osg (attached), which on 
Windows/Linux appears like screen_shot_0_0.jpg
In the OSG android viewer example it appears like osgAndroidLightOn.jpg and if 
I toggle the light with the corresponding button I get osgAndroidLightOff.jpg.
no message in LogCat about lights, the only message is about arial.ttf missing.
I know I am probably showing how daft I am, but I thought the viewers would 
have shown the same model in the same way.
Thanks
Maurizio

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




Attachments: 
http://forum.openscenegraph.org//files/osgandroidlightoff_208.jpg
http://forum.openscenegraph.org//files/osgandroidlighton_123.jpg
http://forum.openscenegraph.org//files/screen_shot_0_0_185.jpg
http://forum.openscenegraph.org//files/cell_100.osg


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


Re: [osg-users] colours in Android OSG

2012-04-25 Thread Maurizio Lodo
Thanks Jason,
true, I was using ShapeDrawables. However, I was already working on converting 
the geometries to use osg::Geometry. I have not done the cylinders yet; however 
I have converted the cubes, and, unfortunately the results are exactly the 
same. The code used to generate the cube geometry is pretty basic. Here it is:
Code:
osg::Geometry* CCubicPore::createCubeGeometry( const osg::Vec3 halfLengths, 
const osg::Vec4 color)
 {
const float xMin( -halfLengths[ 0 ] );
const float xMax( halfLengths[ 0 ] );
const float yMin( -halfLengths[ 1 ] );
const float yMax( halfLengths[ 1 ] );
const float zMin( -halfLengths[ 2 ] );
const float zMax( halfLengths[ 2 ] );

 osg::Geometry* cube = new osg::Geometry();
 osg::ref_ptr osg::Vec3Array  vertices = osg::ref_ptr osg::Vec3Array ( 
new osg::Vec3Array );
 osg::ref_ptr osg::Vec3Array  normals = osg::ref_ptr osg::Vec3Array ( 
new osg::Vec3Array );
 osg::ref_ptr osg::Vec4Array  colors = osg::ref_ptr osg::Vec4Array ( 
new osg::Vec4Array );

// front face
 vertices-push_back( osg::Vec3(xMin,yMin,zMax) );
 vertices-push_back( osg::Vec3(xMax,yMin,zMax) );
 vertices-push_back( osg::Vec3(xMax,yMax,zMax) );
 vertices-push_back( osg::Vec3(xMin,yMax,zMax) );
 normals-push_back( osg::Vec3( 0.0, 0.0, -1.0 ) );

 // back face
 vertices-push_back( osg::Vec3(xMax,yMin,zMin) );
 vertices-push_back( osg::Vec3(xMin,yMin,zMin) );
 vertices-push_back( osg::Vec3(xMin,yMax,zMin) );
 vertices-push_back( osg::Vec3(xMax,yMax,zMin) );
 normals-push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );

 // left
 vertices-push_back( osg::Vec3(xMin,yMax,zMax) );
 vertices-push_back( osg::Vec3(xMin,yMax,zMin) );
 vertices-push_back( osg::Vec3(xMin,yMin,zMin) );
 vertices-push_back( osg::Vec3(xMin,yMin,zMax) );
normals-push_back( osg::Vec3( -1.0, 0.0, 0.0 ) );

// right
vertices-push_back( osg::Vec3(xMax,yMax,zMin) );
vertices-push_back( osg::Vec3(xMax,yMax,zMax) );
vertices-push_back( osg::Vec3(xMax,yMin,zMax) );
vertices-push_back( osg::Vec3(xMax,yMin,zMin) );
 normals-push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );

 // bottom
 vertices-push_back( osg::Vec3(xMax,yMin,zMax) );
 vertices-push_back( osg::Vec3(xMin,yMin,zMax) );
 vertices-push_back( osg::Vec3(xMin,yMin,zMin) );
 vertices-push_back( osg::Vec3(xMax,yMin,zMin) );
 normals-push_back( osg::Vec3( 0.0, -1.0, 0.0 ) );

 // top
 vertices-push_back( osg::Vec3(xMax,yMax,zMax) );
 vertices-push_back( osg::Vec3(xMax,yMax,zMin) );
 vertices-push_back( osg::Vec3(xMin,yMax,zMin) );
 vertices-push_back( osg::Vec3(xMin,yMax,zMax) );
 normals-push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
 
 cube-addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS, 0, 
vertices-size() ) );
 cube-setVertexArray( vertices );

 cube-setTexCoordArray( 0, vertices );

 cube-setNormalArray( normals );
 cube-setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );

 colors-push_back( color );
 cube-setColorArray( colors );
 cube-setColorBinding( osg::Geometry::BIND_OVERALL );

 return cube;
 }



then I use osg::PositionAttitudeTransform to move the cubes to the correct 
position. 

Cheers,
Maurizio

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





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


Re: [osg-users] colours in Android OSG

2012-04-25 Thread Maurizio Lodo
Unfortunately not. I am not getting this at all. The colour info is there, as 
you can see if I turn the light off, but as soon as the default headlight is 
turned on it all goes grey. Oh  well thanks for the help anyway. Obviously this 
is not my thing at all! :) 

Cheers,
Maurizio

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





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


Re: [osg-users] colours in Android OSG

2012-04-25 Thread Maurizio Lodo
Thanks guys, you are helping loads. I will try that tomorrow. 
What about GLES2?
Cheers
Maurizio

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





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


Re: [osg-users] colours in Android OSG

2012-04-25 Thread Maurizio Lodo
if I use osg::Material I get no colours and a warning in logcat

Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)

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





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


[osg-users] colours in Android OSG

2012-04-24 Thread Maurizio Lodo
Hi,
 this is probably a daft question, but as I am a noob to the Android-OSG combo, 
I hope you will be gentle. I have built the android osgAndroidExampleGiLES1 and 
I tried to load,  one of my osg models (nothing fancy, just a bunch of cubes 
and cylinders). These models display perfectly in the Viewer in Linux or 
Windows, and the cubes and cylinders, have their right colours, with the right 
shades and all. However, in the Android viewer all is grey (even though the 
shades are fine). If I turn the light off in the Android viewer then the 
colours appear, but they are flat, no shades, no way to even recognise the 
edges of the cubes or anything at all. 
I am guessing it has something to do with lighting, but I cannot work out what 
the difference between the android viewer and the linux/windows one. Can anyone 
point me in the right direction? Much appreciated

Thank you!

Cheers,
Maurizio

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





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


Re: [osg-users] Android GLES2 example help

2012-01-25 Thread Maurizio Lodo
Thanks for your kind reply.
I have found only 2 instances of
LOCAL_ARM_NEON := true
one in /PlatformSpecifics/Android/Android.mk.modules.in
and one in the Android.mk file of the example.
I commented them out but the final result is the same. Am I missing any more of 
these?
Any other suggestion would be welcome.
thanks again.

Cheers,
Maurizio

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





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


[osg-users] Android GLES2 example help

2012-01-21 Thread Maurizio Lodo
Hi,

I have been going through the Android/O,SG tutorial. I compiled OSG for Android 
on my Debian machine, which seems to have completed correctly and I am now 
trying to run the GLES2 example on my Samsung gti5500 with android gingerbread. 
I replaced OSG_ANDROID_DIR with the correct directory and  I added the OSG 
includes to LOCAL_C_INCLUDES. I have also added 
-L/home/maurizio/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/libs/armeabi  to 
LOCAL_LD_FLAGS, in order to avoid a linker  errors. Both the C++ and Java part 
of the example seem to compile without errors, but when I try to run the app on 
my phone it force closes and the log is


Code:
01-21 17:36:38.784: D/libEGL(9462): loaded /system/lib/egl/libGLES_android.so
01-21 17:36:38.964: D/libEGL(9462): loaded /system/lib/egl/libEGL_adreno200.so
01-21 17:36:39.134: D/libEGL(9462): loaded 
/system/lib/egl/libGLESv1_CM_adreno200.so
01-21 17:36:39.134: D/libEGL(9462): loaded 
/system/lib/egl/libGLESv2_adreno200.so
01-21 17:36:39.154: W/EGLview(9462): creating OpenGL ES 2.0 context
01-21 17:36:39.384: D/dalvikvm(9462): Trying to load lib 
/mnt/asec/osg.AndroidExample-2/lib/libosgNativeLib.so 0x40518a70
01-21 17:36:40.294: W/dalvikvm(9462): Exception 
Ljava/lang/UnsatisfiedLinkError; thrown while initializing 
Losg/AndroidExample/osgNativeLib;
01-21 17:36:40.514: W/dalvikvm(9462): threadid=9: thread exiting with uncaught 
exception (group=0x40018560)
01-21 17:36:40.674: E/AndroidRuntime(9462): FATAL EXCEPTION: GLThread 10
01-21 17:36:40.674: E/AndroidRuntime(9462): 
java.lang.ExceptionInInitializerError
01-21 17:36:40.674: E/AndroidRuntime(9462): at 
osg.AndroidExample.EGLview$Renderer.onSurfaceChanged(EGLview.java:319)
01-21 17:36:40.674: E/AndroidRuntime(9462): at 
android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1357)
01-21 17:36:40.674: E/AndroidRuntime(9462): at 
android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1119)
01-21 17:36:40.674: E/AndroidRuntime(9462): Caused by: 
java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]:  5394 
cannot locate 
'_ZTv0_n12_NSt19basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev'...
01-21 17:36:40.674: E/AndroidRuntime(9462): at 
java.lang.Runtime.loadLibrary(Runtime.java:434)
01-21 17:36:40.674: E/AndroidRuntime(9462): at 
java.lang.System.loadLibrary(System.java:554)
01-21 17:36:40.674: E/AndroidRuntime(9462): at 
osg.AndroidExample.osgNativeLib.clinit(osgNativeLib.java:6)
01-21 17:36:40.674: E/AndroidRuntime(9462): ... 3 more



The learning curve of this is actually pretty steep, and I am not sure what am 
I doing wrong and I would really appreciate any help or pointers in the right 
direction.

Thank you!

Cheers,
Maurizio

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





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


[osg-users] [osgPlugins] collada export

2009-11-01 Thread Maurizio Lodo
Hi all,
I was trying to find a way to export my model created with OSG so that I can 
play with it in Blender. The only solution at the moment seems the Collada 
plugin. So I compiled collada-dom 2.2, then I tried 2.1, and I even found some 
Ubuntu pre-compiled collada-dom/libminizip installers, and then I recompiled 
OSG 2.8.2 in turn with each of these versions of collada-dom. Results with all 
of them is that I can open .dae files with osgviewer, which makes me believe 
that the plugin is installed and working correctly. However if I add 
osgDB::writeNodeFile( *root, file.osg ) to the code that generates my model, 
this results in the complete model which i can then view with osgviewer; if I 
add osgDB::writeNodeFile( *root, file.dae ) the resulting .dae file is very 
small (few kBytes, against the 3 or 4 Mbytes of the .osg file) and when I open 
it with osgviewer, there is nothing there. Am I missing something obvious here? 
Same happens if i try to convert the .osg file to .dae using os
 gconv.

Would there be anyone so kind to use a working version of osgconv on a .osg 
file in order to convert it to .dae for me? It would be very much appreciated


Thank you!

Cheers,
Maurizio

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





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


Re: [osg-users] recent update-texture issue

2009-10-30 Thread Maurizio Lodo
some more info: the texture is generated with:


Code:
osg::TextureCubeMap* generateTexture()
{
// 2D image texture
osg::TextureCubeMap* texture = new osg::TextureCubeMap;
// load  images
osg::Image* frontTextureImage = 
osgDB::readImageFile(./texture/frontLarge.png);
osg::Image* backTextureImage = 
osgDB::readImageFile(./texture/backLarge.png);
osg::Image* leftTextureImage = 
osgDB::readImageFile(./texture/leftLarge.png);
osg::Image* rightTextureImage = 
osgDB::readImageFile(./texture/rightLarge.png);
osg::Image* topTextureImage = 
osgDB::readImageFile(./texture/topLarge.png);
osg::Image* bottomTextureImage = 
osgDB::readImageFile(./texture/bottomLarge.png);

// Assign the texture to the imagesread from file:
texture-setImage(osg::TextureCubeMap::POSITIVE_X,leftTextureImage);

texture-setImage(osg::TextureCubeMap::NEGATIVE_X,rightTextureImage);//swapped 
left and right to be consistent with OSG's throats orientation
texture-setImage(osg::TextureCubeMap::POSITIVE_Y,backTextureImage);
texture-setImage(osg::TextureCubeMap::NEGATIVE_Y,frontTextureImage);
texture-setImage(osg::TextureCubeMap::POSITIVE_Z,topTextureImage);
texture-setImage(osg::TextureCubeMap::NEGATIVE_Z,bottomTextureImage);

return texture;
}


 and in the main I have:

Code:
   
osg::TexGen *tg = new osg::TexGen;
tg-setMode(osg::TexGen::OBJECT_LINEAR);

// Create a StateSet with default settings:
osg::StateSet* stateOne = new osg::StateSet();


stateOne-setTextureAttributeAndModes(0,generateTexture(),osg::StateAttribute::ON);
stateOne-setTextureAttributeAndModes(0, tg, osg::StateAttribute::OVERRIDE 
| osg::StateAttribute::ON);



Can anyone suggest why would this stop working properly after the update? 
Cheers,
Maurizio.


PS the frontLarge.png does not display correctly in the forum preview.

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





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


Re: [osg-users] how to improve frame rate of my scene with lots of cubes and cylinders?

2009-10-20 Thread Maurizio Lodo
Hi,
Should this be done within VertexShader using GLSL? I tried to create a light 
following the osglight example, but it did not make any difference.
Cheers,
Maurizio

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





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


Re: [osg-users] how to improve frame rate of my scene with lots of cubes and cylinders?

2009-10-18 Thread Maurizio Lodo
Hi,
Thanks Peter for your very helpful reply. I have sorted that issue thank to 
your pointers.
Now I have only one more question then I promise I won't bother you anymore. It 
seems that when I generate my model using the simple geometries I created and 
using VertexShader, the resulting cube, for example, has a very flat uniform 
colour, where it is impossible to distinguish the various faces. This does not 
happen when using the shapeDrawable cube or cylinder and so on. Would any of 
you mind pointing me in the right direction of how to resolve this?


Thank you!

Cheers,
Maurizio

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





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


Re: [osg-users] how to improve frame rate of my scene with lots of cubes and cylinders?

2009-10-14 Thread Maurizio Lodo
Hi all,
Finally I found some time to play with this. Thanks to your words of wisdom, I 
have decided to create my cylinder geometry. I used the drawinstanced example 
as a template and I managed to generate the cylinders, translate them and 
rotate them as I want.
However I notice that when I get closer to these cylinders, they disappear, 
while ojects created using ShapeDrawable do not disappear. I do not know 
anything about GLSL (or OpenGL or OpenSceneGraph for that matter) and I was 
wondering if anyone could tell me why this is happening, if there is a way to 
fix it and if that would affect performance.

Thank you very much!

Cheers,
Maurizio

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





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


Re: [osg-users] how to improve frame rate of my scene with lots of cubes and cylinders?

2009-10-02 Thread Maurizio Lodo
Thanks for your replies!! I have been reading through this forum and googled a 
lot and it seems the best solution for my problem would be to create a 
simplified cylinder geometry (which I have done), divide all the cylinders into 
bins (by diameter, as they will have all the same length), and use geometry 
instancing to create several instances of the representative cylinder for each 
bin, translatated and rotated so that they would appear in the correct position 
in the scene. Would this sound sensible to you?
Unfortunately this is were the learning curve gets a little steep though. I 
cannot seem to figure out how to use geometry instancing just by reading the 
drawinstanced example. Is there any tutorial around? or any other examples that 
would be helpful.

Thanks again,
Maurizio

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





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


Re: [osg-users] Quad buffer stereo issue

2009-09-06 Thread Maurizio Lodo
Hi,
Just an update. I was looking for a stereo VRML viewer and I found White Dune. 
Well the strange thing is that when I start White Dune with the stereo mode 
enabled, then also osgviewer works perfectly without flickering of the image 
between the left and right picture. As soon as I close WhiteDune then osgviewer 
goes back to the strange behaviour described in the previous post. Is there 
anyone who can make sense out of this?

Thank you for your help!

Cheers,
Maurizio

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





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


[osg-users] [osgPlugins] can't compile VRML plugin

2009-09-06 Thread Maurizio Lodo
Hi,

I was following the tutorial  here 
(http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/VisualStudio/VisualStudioPlugins)
I compiled OpenVRML without any issue. but when it comes to using CMake on the 
VRML plugin I downloaded here 
(http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgPlugins/vrml?rev=8591)
 the tutorial stops making sense..I cannot find where I should be specifying 
the ...\OpenVRML\home-built\include directory in OPENVRML_INCLUDE_DIR and 
...\OpenVRML\home-built\lib\openvrml.lib library in OPENVRML_LIBRARY. . When I 
generate I end up with an VC++ solution that does not include any of the 
original source files, and as such when I compile it with VC++ (2005) the 
compilation is skipped (as there is nothing to compile). I apologise if these 
are stupid issues but I am new to OSG and to CMake as well.

Thank you!

Cheers,
Maurizio

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





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


[osg-users] Quad buffer stereo issue

2009-09-02 Thread Maurizio Lodo
Hi,

I am completely new to OpenSceneGraph and I bumped into this issue that I hope 
you may be able to help me with. I have installed from binaries on our quad 
core vista 64 bit computer with Nvidia Quadro FX4600 graphic card. I tested 
with 
Code:
osgviewer cow.osg

 and all works as it should. However, my aim is to display VRML files using a 
stereoscopic system by Planar. Well, when I try 
Code:
osgviewer cow.osg --stereo QUAD_BUFFER

 the top screen works fine but the bottom screen seems to be displaying both 
the left and right images switching very quickly between the 2. It actually 
worked perfectly once, when it also gave me this warning message (which never 
appeared when it was not working right): 

Code:
Warning:GraphicsWindowWin32::grabFocus() Failed grabbing the focus


Am I missing something obvious? 
Thank you in advance for your help!

Cheers,
Maurizio

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





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