Re: [osg-users] [build] problem compiling osg 3.0.0 for Android

2011-07-14 Thread Rubén Díaz
Hi,

I am having some trouble compiling osg for Android... 

These are the options I pick with cmake:


Code:
OSG_GL1_AVAILABLEOFF
OSG_GL2_AVAILABLEOFF
OSG_GL3_AVAILABLEOFF
OSG_GLES1_AVAILABLE  OFF
OSG_GLES2_AVAILABLE  ON
OPENGL_INCLUDE   /home/rubn/data/android/gl/khronos_headers/GLES2
OPENGL_LIBRARY  
/home/rubn/data/android/android-ndk/platforms/android-9/arch-arm/usr/lib/libGLESv2.so
OPENGL_egl_LIBRARY   
/home/rubn/data/android/android-ndk/platforms/android-9/arch-arm/usr/lib/libEGL.so
OSG_GL_DISPLAYLISTS_AVAILABLEOFF
SG_GL_MATRICES_AVAILABLE OFF
OSG_GL_VERTEX_FUNCS_AVAILABLEOFF
OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE  OFF
OSG_GL_FIXED_FUNCTION_AVAILABLE  OFF
OSG_CPP_EXCEPTIONS_AVAILABLE OFF
OSG_BUILD_ANDROID_PLATFORM   ON
ANDROID_NDK/home/rubn/data/android/android-ndk
DYNAMIC_OPENTHREADS OFF
DYNAMIC_OPENSCENEGRAPHOFF 



When I press generate everything works just fine, no error messages... When I 
try to compile using make from the shell, I get:

Code:
rubn@CPU00063:~/data/OpenSceneGraph/build$ make
[  0%] Generating Android-OpenSceneGraph
Android NDK: NDK installation path auto-detected: 
'/home/rubn/data/android/android-ndk'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: linux
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to linux-x86
Android NDK: Host awk tool was auto-detected: awk
Android NDK: Host awk test returned: Pass
Android NDK:  This NDK supports the following toolchains and target ABIs:
Android NDK:arm-linux-androideabi-4.4.3:  armeabi armeabi-v7a
Android NDK:x86-4.4.3:  x86
Android NDK: Found platform root directory: 
/home/rubn/data/android/android-ndk/platforms
Android NDK: Found supported platforms: android-3 android-4 android-5 android-8 
android-9
Android NDK: PLATFORM android-3 supports: arm x86
Android NDK:   ABI arm sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-3/arch-arm
Android NDK:   ABI x86 sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-3/arch-x86
Android NDK: PLATFORM android-4 supports: arm x86
Android NDK:   ABI arm sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-4/arch-arm
Android NDK:   ABI x86 sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-4/arch-x86
Android NDK: PLATFORM android-5 supports: arm x86
Android NDK:   ABI arm sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-5/arch-arm
Android NDK:   ABI x86 sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-5/arch-x86
Android NDK: PLATFORM android-8 supports: arm x86
Android NDK:   ABI arm sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-8/arch-arm
Android NDK:   ABI x86 sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-8/arch-x86
Android NDK: PLATFORM android-9 supports: arm x86
Android NDK:   ABI arm sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-9/arch-arm
Android NDK:   ABI x86 sysroot is: 
/home/rubn/data/android/android-ndk/platforms/android-9/arch-x86
Android NDK: Found stable platform levels: 3 4 5 8 9
Android NDK: Found max platform level: 9
Android NDK: Looking for AndroidManifest.xml in 
/home/rubn/data/OpenSceneGraph/build
Android NDK: Found it !
Android NDK: Found project path: /home/rubn/data/OpenSceneGraph/build
Android NDK: Parsing Application.mk
Android NDK:   Using build script ./Android.mk
Android NDK: Application 'local' is not debuggable
Android NDK: Selecting optimization mode through Application.mk: release
Android NDK: Adding import directory: 
/home/rubn/data/android/android-ndk/sources
Android NDK: Building application 'local' for ABI 'armeabi'
Android NDK: Using target toolchain 'arm-linux-androideabi-4.4.3' for 'armeabi' 
ABI
Android NDK: Looking for imported module with tag 'cxx-stl/gnu-libstdc++'
Android NDK:   Probing 
/home/rubn/data/android/android-ndk/sources/cxx-stl/gnu-libstdc++/Android.mk
Android NDK: Found in 
/home/rubn/data/android/android-ndk/sources/cxx-stl/gnu-libstdc++
Android NDK: Trying to define local module 'OpenThreads' in 
/home/rubn/data/OpenSceneGraph/build/src/OpenThreads/pthreads/Android.mk.
Android NDK: But this module was already defined by 
/home/rubn/data/OpenSceneGraph/build/src/OpenThreads/pthreads/Android.mk.
/home/rubn/data/android/android-ndk/build/core/build-module.mk:34: *** Android 
NDK: Aborting..  Stop.
make[2]: *** [Android-OpenSceneGraph] Error 2
make[1]: *** [CMakeFiles/ndk.dir/all] Error 2
make: *** [all] Error 2



And that's pretty much it... I also try with
$ $ANDROID_NDK/ndk_build NDK_APPLICATION_MK=Application.mk
but no luck


Android NDK: Trying to define local module 'OpenThreads' in 
/home/rubn/data/OpenSceneGraph/build/src/OpenThreads/pthreads/Android.mk.
Android NDK: But this module was already defined by 
/home/rubn/data/OpenSceneGraph/build/src/OpenThreads/pthreads/Android.mk.
any idea why I am getting this err

Re: [osg-users] [build] problem compiling osg 3.0.0 for Android

2011-07-15 Thread Rubén Díaz
Hi,

Thanks a lot for your reply.
I tried with the changes that you suggested and still didn't work using the 
graphic frontend for cmake.


Using the console, everything fine. 
(I used r6, and got osg from trunk).

Thanks again!

Cheers,
ruben

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





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


Re: [osg-users] [build] problem compiling osg 3.0.0 for Android

2011-07-18 Thread Rubén Díaz
Hi again,


> Have fun with Osg and Android. 

Thanks, I'll do my best :P

I've been checking out the android examples, both osgAndroidExampleGLES1 and 
osgAndroidExampleGLES2. 

No problem with osgAndroidExampleGLES1 :)

But when it comes to do the same thing with osgAndroidExampleGLES2, I am not 
having the same luck. I get a bunch of errors when I use ndk-build.

I am gonna assume that osg has been compiled using the OpenGL ES 1.1 API? Do I 
have to recompile or something? 

Thanks once again.

Cheers,
Rubén

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





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


Re: [osg-users] [build] problem compiling osg 3.0.0 for Android

2011-07-20 Thread Rubén Díaz
Cool, thanks!

Good luck with your project!

Cheers,
Rubén

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





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


[osg-users] osgDB::readNodeFile returning null in Android

2011-07-20 Thread Rubén Díaz
Hi there,

I am new to Android and fairly new to OSG. I recently managed to compile 
Android for OpenGL ES 2.0 on Ubuntu Linux 11.04 following 
http://forum.openscenegraph.org/viewtopic.php?t=8774. 
Everything worked fine and now I get "the OSG blue screen" on my device 
already. 

I am attempting to load a model, and therefore I use 

Code:
osg::ref_ptr loadedModel = osgDB::readNodeFile(newModel.filename);


as in the examples provided.
but nothing comes up in the screen. Debugging I've found out that 
osgDB::readNodeFile is returning null all the time. I've tried with different 
paths. As I am new to Android I am not sure if applications have permissions to 
access files in shared memory. In the Android Developers' webpage I saw an 
entry that addresses this issue:
http://developer.android.com/guide/topics/data/data-storage.html
And so I tried using:
/Android/data/osg.AndroidExample.osgViewer/files/models/cow.osg
but still... the cow is being shy and doesn't want to appear on the screen :P

I don't get any error messages or anything... I am just getting null in return 
from the osgDB::readNodeFile call.

Any ideas of why this is happenning??


Thanks a lot in advance.

Cheers,
Rubén

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





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


Re: [osg-users] osgDB::readNodeFile returning null in Android

2011-07-21 Thread Rubén Díaz
adb shell 

certainly the way to go...

Thanks!

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





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


Re: [osg-users] [build] problem compiling osg 3.0.0 for Android

2011-07-28 Thread Rubén Díaz
Hi,

just a quick one... (I was not sure whether I should have posted it here or 
somewhere else. anyway...)

I was testing the example application for OpenGL ES 2.0 and worked flawlessly 
using the Android 2.2 SDK. I tested on a Samsung Galaxy Tablet.
I am testing now, using the Android 3.1 SDK for an ASUS Eee Pad Transformer. 
And I am out of luck...

The result I get is the application starting (I can see the menu but the rest 
is black) and suddenly exiting a couple of seconds after. No error messages. 
Is this version of android (3.0 or 3.1) supported?

Thank you!

Cheers,
Rubén

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





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


[osg-users] manual camera view matrix update

2011-09-06 Thread Rubén Díaz
Hi there,

This should be a quick one. I am using OSG compiled for Android OpenGL ES 2.0.
I have my app up and running on the device. My shaders for the object I am 
displaying doesn't do anything special, but it works just fine.

My problem is, I need to update the camera matrix manually, this means: I 
update the view matrix for every frame (or whenever I need to).
Well, my shader doesn't seem to care about my efforts. Nothing changes after I 
attempt to change the matrix for the camera. For that purpose I use:


Code:
void OsgMainApp::setModelViewMatrix( osg::Matrixf osgMat ){

_viewer->getCamera()->setViewMatrix(osgMat);

}



that I use every frame I need to before doing:

Code:
_viewer->frame();



But camera shader uniforms doesn't seem to be updating.
What am I missing?? Any hint?

As you can guess I am not very experienced with osg.


Thanks a lot!

Cheers,
Rubén

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





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


Re: [osg-users] manual camera view matrix update

2011-09-07 Thread Rubén Díaz
Hi,

Thanks for your reply!

Well, I've tried with the "osg_" uniforms instead of the typical "gl_" uniforms.

Still not good. My model appears but the camera matrix uniform just doesn't 
update by using 

Code:
_viewer->getCamera()->setViewMatrix(osgMat); 



The shader I am using is:


Code:
static const char gVertexShader[] =
"varying vec4 color;\n"
"const vec3 lightPos  =vec3(100.0, 100.0, 100.0);   \n"
"const vec4 cessnaColor   =vec4(0.8, 0.0, 0.0, 1.0);\n"
"const vec4 lightAmbient  =vec4(0.1, 0.1, 0.1, 1.0);\n"
"const vec4 lightDiffuse  =vec4(0.4, 0.4, 0.4, 1.0);\n"
"const vec4 lightSpecular =vec4(0.8, 0.8, 0.8, 1.0);\n"

"uniform mat4 osg_ModelViewMatrix;  
\n"
"uniform mat4 osg_ModelViewProjectionMatrix;
\n"
"uniform mat3 osg_NormalMatrix; 
\n"

"void DirectionalLight(in vec3 normal,  \n"
"  in vec3 ecPos,   \n"
"  inout vec4 ambient,  \n"
"  inout vec4 diffuse,  \n"
"  inout vec4 specular) \n"
"{  \n"
" float nDotVP; \n"
" vec3 L = normalize(osg_ModelViewMatrix*vec4(lightPos, 0.0)).xyz;   \n"
" nDotVP = max(0.0, dot(normal, L));\n"
"   \n"
" if (nDotVP > 0.0) {   \n"
"   vec3 E = normalize(-ecPos); \n"
"   vec3 R = normalize(reflect( L, normal ));   \n"
"   specular = pow(max(dot(R, E), 0.0), 16.0) * lightSpecular;  \n"
" } \n"
" ambient  = lightAmbient;  \n"
" diffuse  = lightDiffuse * nDotVP; \n"
"}  \n"
"void main() {  \n"
"vec4 ambiCol = vec4(0.0);  \n"
"vec4 diffCol = vec4(0.0);  \n"
"vec4 specCol = vec4(0.0);  \n"
"gl_Position   = osg_ModelViewProjectionMatrix * gl_Vertex;  \n"
"vec3 normal   = normalize(osg_NormalMatrix * gl_Normal);\n"
"vec4 ecPos= osg_ModelViewMatrix * gl_Vertex;\n"
"DirectionalLight(normal, ecPos.xyz, ambiCol, diffCol, specCol);\n"
"color = cessnaColor * (ambiCol + diffCol + specCol);   \n"
"}  \n";

static const char gFragmentShader[] =
"precision mediump float;  \n"
"varying mediump vec4 color;   \n"
"void main() { \n"
"  gl_FragColor = color;   \n"
"} \n";





No idea what's going wrong...


Cheers,
Rubén

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





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


Re: [osg-users] manual camera view matrix update

2011-09-07 Thread Rubén Díaz
It is weird... I've accessed the value with 
getUseModelViewAndProjectionUniforms() and it's set to true.

:S

Cheers,
Rubén

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





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