Re: [osg-users] OSG for Android
Try cleaning Cmake configure of the osg directory first. And don't use a graphical Cmake bad shit happens sometimes. In wiki there is a comand line cmake example. El 8 de agosto de 2011 07:55, Héctor Martínez escribió: > and clicking the Configure button, a huge amount of similar errors appear. > I have tried with An ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi Jorge, thank you for your response! You were right, it works with command line. But now I have new problems: - It doesn´t find some plugins (jpg, png etc). - When trying to build the solution I get this error: 2>InitializeBuildStatus: 2> Touching "Win32\Debug\ndk\ndk.unsuccessfulbuild". 2>CustomBuild: 2> The system cannot find the path specified. 2> Generating Android-OpenSceneGraph 2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3. 2> 2>Build FAILED Any ideas about whats wrong? Thank you. Cheers, Héctor From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jorge Izquierdo Ciges Sent: lunes, 08 de agosto de 2011 10:42 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android Try cleaning Cmake configure of the osg directory first. And don't use a graphical Cmake bad shit happens sometimes. In wiki there is a comand line cmake example. El 8 de agosto de 2011 07:55, Héctor Martínez escribió: and clicking the Configure button, a huge amount of similar errors appear. I have tried with An ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Mmm first it doesn't find the plugins because you don't have them xD we have a third party package that... it seems we forgot to publish the link in the wiki (and i don't know the address in my head). The other thing is probably a error because i think ndk is not prepared to run in windows as it is. I think you need mingw or something like that. I use to make my tests over Linux so I don't know exactly the conditions that google have for windows. (check that on the developers android) El 8 de agosto de 2011 11:13, Héctor Martínez escribió: > exited with code 3. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
2011/8/8 Héctor Martínez > Hi Jorge, > > ** ** > > thank you for your response! You were right, it works with command line. > But now I have new problems: > > ** ** > > **- **It doesn´t find some plugins (jpg, png… etc). > > **- **When trying to build the solution I get this error: > > 2>InitializeBuildStatus: > > 2> Touching "Win32\Debug\ndk\ndk.unsuccessfulbuild". > > 2>CustomBuild: > > 2> The system cannot find the path specified. > > 2> Generating Android-OpenSceneGraph > > 2>C:\Program Files > (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error > MSB6006: "cmd.exe" exited with code 3. > > 2> > > 2>Build FAILED > > ** ** > > Any ideas about what’s wrong? > > ** ** > > Thank you. > > ** ** > > Cheers, > > ** ** > > Héctor > Hi Hector, You can't use Visual Studio to build OSG for android. You need to choose "Unix Makefile" as generator in CMake gui. Mourad > > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Thank you again, Jorge. I will try with MinGW. But, will I be able to use the compiled library in an Eclipse+Windows environment for the Android development? Regarding to the plugins, I thought that there were the same as the ones inside the 3rdparty folder of OSG. Do you think I will be able to get those you mention? From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jorge Izquierdo Ciges Sent: lunes, 08 de agosto de 2011 13:36 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android Mmm first it doesn't find the plugins because Thank you Mourad. As I say above, I will try with MinGW. From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Mourad Boufarguine Sent: lunes, 08 de agosto de 2011 13:40 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android Hi Hector, You can't use Visual Studio to build OSG for android. You need to choose "Unix Makefile" as generator in CMake gui. Mourad Héctor ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
There's no trouble in that. Android binaries are platform independant (they are from Android) and I suppose following the google instructions shouldn't give much trouble to anyone. I didn't like MinGW so I sticked with Linux. I'll try to find the 3rd party package link and submit it when I can... but right now I'm on vacation so i can't reach physically where it is. El 8 de agosto de 2011 14:36, Héctor Martínez escribió: > . But, will I be able to use the compiled library in an Eclipse+Windows > environment for the Android development? > > Regarding to the plugins, I thought that there were the same as the ones > inside the 3rdparty folder of OSG. Do you think I will be able to get those > you mention? > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi Hector, ThirdParty package for android is deployed here: http://www2.ai2.upv.es/difusion/osgAndroid/3rdpartyAndroid.zip I'm sure other developers reported that they were able to build in windows using mingw or cygwin but we usually work on linux or mac (making our life easier! :)). Cheers, Rafa. 2011/8/8 Jorge Izquierdo Ciges : > There's no trouble in that. Android binaries are platform independant (they > are from Android) and I suppose following the google instructions shouldn't > give much trouble to anyone. I didn't like MinGW so I sticked with Linux. > I'll try to find the 3rd party package link and submit it when I can... but > right now I'm on vacation so i can't reach physically where it is. > > El 8 de agosto de 2011 14:36, Héctor Martínez > escribió: >> >> . But, will I be able to use the compiled library in an Eclipse+Windows >> environment for the Android development? >> >> Regarding to the plugins, I thought that there were the same as the ones >> inside the 3rdparty folder of OSG. Do you think I will be able to get those >> you mention? > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- Rafael Gaitán Linares Instituto de Automática e Informática Industrial http://www.ai2.upv.es http://gvsig3d.blogspot.com Ciudad Politécnica de la Innovación Universidad Politécnica de Valencia ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Thank you for the response. I am having some problems with the MINGW/MSYS make. Here is the problem: Android NDK: Trying to define local module OpenThreads in C:/Projects/OpenSceneGraph-3.0.1/OpenSceneGraph/build32_Android/src/OpenThre ads/pthreads/Android.mk. Android NDK: But this module was already defined by C:/Projects/OpenSceneGraph-3.0.1/OpenSceneGraph/build32_Android/src/OpenThre ads/pthreads/Android.mk. /C/Projects/android-ndk-r5b/build/core/build-moduloe.mk:34: *** Android NDK: Aborting. . Stop. make[2]: *** [Android-OpenSceneGraph] Error 2 make[1]: *** [CMakeFiles/ndk.dir/all] Error 2 Any ideas? It seems like it is loading some file twice or something like that. From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jorge Izquierdo Ciges Sent: lunes, 08 de agosto de 2011 17:14 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android There's no trouble in that. Android binaries are platform independant (they are from Android) and I suppose following the google instructions shouldn't give much trouble to anyone. I didn't like MinGW so I sticked with Linux. - Thank you for the dependencies. But, how am I supposed to use them? I mean, which is the structure for cmake to recognize them? -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Rafa Gaitan Sent: martes, 09 de agosto de 2011 9:10 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android Hi Hector, ThirdParty package for android is deployed here: <http://www2.ai2.upv.es/difusion/osgAndroid/3rdpartyAndroid.zip> http://www2.ai2.upv.es/difusion/osgAndroid/3rdpartyAndroid.zip Cheers, Héctor ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi Hector, 2011/8/10 Héctor Martínez > Thank you for the response. I am having some problems with the MINGW/MSYS > make. Here is the problem: > You have to use Cygwin not MinGW/MSYS on windows to develop with android ndk. Mourad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
YAOUCH! I missed that! xD you are damn right. 2011/8/10 Mourad Boufarguine > Hi Hector, > > > 2011/8/10 Héctor Martínez > >> Thank you for the response. I am having some problems with the MINGW/MSYS >> make. Here is the problem: >> > You have to use Cygwin not MinGW/MSYS on windows to develop with android > ndk. > > Mourad > > ___ > 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] OSG for Android
Thank you Mourad and Jorge. I have never used CygWin and I am trying to follow those instructions: <http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/C ygwin> http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Cy gwin But it is a bit messy for me. Mourad, it seems like you have successfully compiled OSG for Android in Windows. Could you please give me a quick guide or some tips? Héctor From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jorge Izquierdo Ciges Sent: miércoles, 10 de agosto de 2011 19:31 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android YAOUCH! I missed that! xD you are damn right. 2011/8/10 Mourad Boufarguine Hi Hector, 2011/8/10 Héctor Martínez Thank you for the response. I am having some problems with the MINGW/MSYS make. Here is the problem: You have to use Cygwin not MinGW/MSYS on windows to develop with android ndk. Mourad ___ 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] OSG for Android
Hi Hector, 2011/8/11 Héctor Martínez > Thank you Mourad and Jorge. > > ** ** > > I have never used CygWin and I am trying to follow those instructions: > > ** ** > > > http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Cygwin > Those are for building OSG with cygwin to be used on a PC. > > > ** ** > > But it is a bit messy for me. Mourad, it seems like you have successfully > compiled OSG for Android in Windows. Could you please give me a quick guide > or some tips? > > ** > 1/ install Cygwin ^^ , make sure to install gcc , g++, make, ... (a full install may be helpful). Please note that, although we won't be compiling osg with cygwin's g++ , it needs to be installed in order for cmake to get over compiler checks at the beginning of configuration. (and other packages may be also needed) 2/ in cmake gui, set the sources and binairies folders, hit configure and choose "Unix Makefiles" as generator 3/ Check "OSG_BUILD_PLATFORM_ANDROID" and hit configure 4/ Set (if not set) ANDROID_NDK path 5/ Configure your build whether you want GLES1 or GLES2 following these instructions : http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES 6/ Configure and Generate 7/ open Cygwin batch, cd to binaires dir, and "make" ** > > Héctor > > ** ** > > > Cheers, Mourad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi Mourad and all, I've succesfully built osg_3.0.1 on Windows with Cygwin (without 3rd party plugins for now). I'm now trying to build the osgAndroidExampleGLES1, and everything compiles, but the linker (ld) throws an error says that it cannot find the dds lib, here it is: $ ../../../../../Android/android-ndk-r6/ndk-build NDK_APPLICATION_MK=Application.mk Compile++ thumb : osgNativeLib <= osgNativeLib.cpp Compile++ thumb : osgNativeLib <= OsgMainApp.cpp Compile++ thumb : osgNativeLib <= OsgAndroidNotifyHandler.cpp SharedLibrary : libosgNativeLib.so D:/SourceCode/Android/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../ lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: cannot find -losgd b_dds collect2: ld returned 1 exit status make: *** [/cygdrive/d/SourceCode/OSG/osg_3.0.1/examples/osgAndroidExampleGLES1/obj/local/armeabi/libosgNativeLib.so] Error 1 I'm checking the options of the Android.mk file and it looks like there's a variable LIBDIR to specify the library path which is then used here: [...] LOCAL_LDFLAGS := -L $(LIBDIR) \ -losgdb_dds \ [...] I've already tried to set it to relative and absolute paths, I've also tried to copy the compiled libraries in the local example folder, but cannot get it finding the libraries! Have you got any other suggestion? Thank you, Ricky On Thu, Aug 11, 2011 at 13:09, Mourad Boufarguine < mourad.boufargu...@gmail.com> wrote: > Hi Hector, > > 2011/8/11 Héctor Martínez > >> Thank you Mourad and Jorge. >> >> ** ** >> >> I have never used CygWin and I am trying to follow those instructions:*** >> * >> >> ** ** >> >> >> http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Cygwin >> > > Those are for building OSG with cygwin to be used on a PC. > > >> >> >> ** ** >> >> But it is a bit messy for me. Mourad, it seems like you have successfully >> compiled OSG for Android in Windows. Could you please give me a quick guide >> or some tips? >> >> ** >> > > > 1/ install Cygwin ^^ , make sure to install gcc , g++, make, ... (a full > install may be helpful). > > Please note that, although we won't be compiling osg with cygwin's g++ , it > needs to be installed in order for cmake to get over compiler checks at the > beginning of configuration. (and other packages may be also needed) > > 2/ in cmake gui, set the sources and binairies folders, hit configure and > choose "Unix Makefiles" as generator > > 3/ Check "OSG_BUILD_PLATFORM_ANDROID" and hit configure > > 4/ Set (if not set) ANDROID_NDK path > > 5/ Configure your build whether you want GLES1 or GLES2 following these > instructions : > http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES > > 6/ Configure and Generate > > 7/ open Cygwin batch, cd to binaires dir, and "make" > > ** >> >> Héctor >> >> ** ** >> >> >> Cheers, > Mourad > > > ___ > 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] OSG for Android
On Thu, Aug 11, 2011 at 1:09 PM, Mourad Boufarguine < mourad.boufargu...@gmail.com> wrote: > Hi Hector, > > 2011/8/11 Héctor Martínez > >> Thank you Mourad and Jorge. >> >> ** ** >> >> I have never used CygWin and I am trying to follow those instructions:*** >> * >> >> ** ** >> >> >> http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Cygwin >> > > Those are for building OSG with cygwin to be used on a PC. > > >> >> >> ** ** >> >> But it is a bit messy for me. Mourad, it seems like you have successfully >> compiled OSG for Android in Windows. Could you please give me a quick guide >> or some tips? >> >> ** >> > > > 1/ install Cygwin ^^ , make sure to install gcc , g++, make, ... (a full > install may be helpful). > > Please note that, although we won't be compiling osg with cygwin's g++ , it > needs to be installed in order for cmake to get over compiler checks at the > beginning of configuration. (and other packages may be also needed) > > 2/ in cmake gui, set the sources and binairies folders, hit configure and > choose "Unix Makefiles" as generator > > 3/ Check "OSG_BUILD_PLATFORM_ANDROID" and hit configure > > 4/ Set (if not set) ANDROID_NDK path > > 5/ Configure your build whether you want GLES1 or GLES2 following these > instructions : > http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES > > 6/ Configure and Generate > > 7/ open Cygwin batch, cd to binaires dir, and "make" > > ** >> >> Héctor >> >> ** ** >> >> >> Cheers, > Mourad > > After re trying and checking, i found out that it is preferable to use the command line cmake in cygwin rather than cmake gui : cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DOSG_GL_MATRICES_AVAILABLE=ON -DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON -DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF -DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=ON -DOSG_GLES2_AVAILABLE=OFF Mourad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi Riccardo, On Thu, Aug 11, 2011 at 1:59 PM, Riccardo Corsi wrote: > Hi Mourad and all, > > I've succesfully built osg_3.0.1 on Windows with Cygwin (without 3rd party > plugins for now). > > I'm now trying to build the osgAndroidExampleGLES1, and everything > compiles, but the linker (ld) throws an error says that it cannot find the > dds lib, here it is: > > $ ../../../../../Android/android-ndk-r6/ndk-build > NDK_APPLICATION_MK=Application.mk > Compile++ thumb : osgNativeLib <= osgNativeLib.cpp > Compile++ thumb : osgNativeLib <= OsgMainApp.cpp > Compile++ thumb : osgNativeLib <= OsgAndroidNotifyHandler.cpp > SharedLibrary : libosgNativeLib.so > > D:/SourceCode/Android/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../ > lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: > cannot find -losgd > b_dds > collect2: ld returned 1 exit status > make: *** > [/cygdrive/d/SourceCode/OSG/osg_3.0.1/examples/osgAndroidExampleGLES1/obj/local/armeabi/libosgNativeLib.so] > Error 1 > > I'm checking the options of the Android.mk file and it looks like there's a > variable LIBDIR to specify the library path which is then used here: > > [...] > LOCAL_LDFLAGS := -L $(LIBDIR) \ > -losgdb_dds \ > [...] > > I've already tried to set it to relative and absolute paths, I've also > tried to copy the compiled libraries in the local example folder, > but cannot get it finding the libraries! > Have you got any other suggestion? > > > What did you put in OSG_ANDROID_DIR ? I just tried with my binaries folder path and it worked. Mourad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Mmmm look the Android make file inside the GLES example and change "type your directory here" into your path to OSG 2011/8/11 Mourad Boufarguine > ed with my binaries folder path and it worked. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi guys, it works!! I had to tweak something and then I've run some tests, let me share some points with you: - Builing I have made a floder called ndk-build inside the osg folder tree to place all the nkd builind stuff. If I set the OSG_ANDROID_DIR to that folder, the compiler doesn't file the osg includes, so I had to add the osg include folder to the "LOCAL_C_INCLUDES". By doing that everything compile and link. What I don't get is why it wasn't working before, when I had edited directly the variables LOCAL_C_INCLUDES and LIBDIR by setting them to full paths -> any hints on this point?? - Running I've been trying only the GLES1 example, and it works just fine on my Nexus S (android 2.3.4) Instead I've tried to build the example also for the 3.x platform target: it build and upload on my tablet, but it just shows up for a couple of seconds and then it dies. I have no time to investigate right now, I'll run some more tests tomorrow. Have you got any idea what it might be depending on? My device is an Acer Iconia Tab A500. Thank you for your support and great job! Ricky On Thu, Aug 11, 2011 at 17:05, Jorge Izquierdo Ciges wrote: > Mmmm look the Android make file inside the GLES example and change "type > your directory here" into your path to OSG > > > 2011/8/11 Mourad Boufarguine > >> ed with my binaries folder path and it worked. > > > > ___ > 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] OSG for Android
I don't have very much idea what can happen with 3.X it would be needed to see in detail the Logcat to find what's happening. 2.3 and 3.X have the same base in common so it shouldn't be anything big. About the other things probably is just that you didn't do a make install to create a directory with all the includes etc. 2011/8/11 Riccardo Corsi > dk-build inside the osg folder tree to place all the nkd builind stuff. If > I set the OSG_ANDROID_DIR to that folder, the compiler doesn't file the osg > includes, so I had to add the osg include folder to the "LOCAL_C_INCLUDES". > By doing that everything compile and link. > What I don't get is why it wasn't working before, when I had edited > directly the variables LOCAL_C_INCLUDES and LIBDIR by setting them to full > paths -> any hints on this point?? > > - Running > I've been trying only the GLES1 example, and it works just fine on my Nexus > S (android 2.3.4) > Instead I've tried to build the example also for the 3.x platform target: > it build and upload on my tablet, but it just shows up for a couple of > seconds and then it dies. > I have no time to investigate right now, I'll run some more tests tomorrow. > Have you got any idea what it might be depending on? > My device is an Acer Iconia Tab A500. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi and thank you. I first tried with the Cmake GUI, but I got some errors. After that, I have read your answer pointing to command line. I have used the cmake command line (not without some problems J ): cmake -> OK make -> Error: make[3]: *** [/cygdrive/c/Projects/OpensSceneGraph-3.0.1/OpenSceneGraph/obj/local/armeabi -v7a/objs/osgdb_serializers_osg/BlendEquation..o] Error 126 make[3]: *** Waiting for unfinished jobs . make[2]: *** [Android-OpenSceneGraph] Error 2 make[1]: *** [CMakeFiles/ndk.dir/all] Error 2 make: *** [all] Error 2 After that, I have tried to use make install and it has finished without error, but I think this is a weird behavior. Anyway, does somebody now how to solve the problem? And another question, after compiling (if I can make it J ), what files (and where) will I need to include in the OSG Android example? Thank you. Cheers, Héctor From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Mourad Boufarguine Sent: jueves, 11 de agosto de 2011 16:50 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android On Thu, Aug 11, 2011 at 1:09 PM, Mourad Boufarguine wrote: Hi Hector, 2011/8/11 Héctor Martínez Thank you Mourad and Jorge. I have never used CygWin and I am trying to follow those instructions: <http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/C ygwin> http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Cy gwin Those are for building OSG with cygwin to be used on a PC. But it is a bit messy for me. Mourad, it seems like you have successfully compiled OSG for Android in Windows. Could you please give me a quick guide or some tips? 1/ install Cygwin ^^ , make sure to install gcc , g++, make, ... (a full install may be helpful). Please note that, although we won't be compiling osg with cygwin's g++ , it needs to be installed in order for cmake to get over compiler checks at the beginning of configuration. (and other packages may be also needed) 2/ in cmake gui, set the sources and binairies folders, hit configure and choose "Unix Makefiles" as generator 3/ Check "OSG_BUILD_PLATFORM_ANDROID" and hit configure 4/ Set (if not set) ANDROID_NDK path 5/ Configure your build whether you want GLES1 or GLES2 following these instructions : http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES 6/ Configure and Generate 7/ open Cygwin batch, cd to binaires dir, and "make" Héctor Cheers, Mourad After re trying and checking, i found out that it is preferable to use the command line cmake in cygwin rather than cmake gui : cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DOSG_GL_MATRICES_AVAILABLE=ON -DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON -DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF -DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=ON -DOSG_GLES2_AVAILABLE=OFF Mourad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
Hi Hector, maybe you can try to use the ndk-build command instead of "make", and see if it runs smooth. If so, probably there's something wrong with the makefile generated by CMake... Regarding the osg Android example, the folder structure is the same as the one of the NDK examples. Build instructions for native projects are very clear on the ndk online documentation, especially if you use Eclipse. You basically need to build the native part of the example before (under the jni folder) the same way you compiled the native osg libs, and afterwards build the java files under src. They make use of the native lib, and both the java code and the native library will be packed in the apk by Eclipse (or the compiler you're using). HTH, Ricky 2011/8/12 Héctor Martínez > Hi and thank you. > > ** ** > > I first tried with the Cmake GUI, but I got some errors. After that, I have > read your answer pointing to command line. I have used the cmake command > line (not without some problems J ): > > cmake -> OK > > make -> Error: > > make[3]: *** > [/cygdrive/c/Projects/OpensSceneGraph-3.0.1/OpenSceneGraph/obj/local/armeabi-v7a/objs/osgdb_serializers_osg/BlendEquation..o] > Error 126 > > make[3]: *** Waiting for unfinished jobs…. > > make[2]: *** [Android-OpenSceneGraph] Error 2 > > make[1]: *** [CMakeFiles/ndk.dir/all] Error 2 > > make: *** [all] Error 2 > > After that, I have tried to use “make install” and it has finished without > error, but I think this is a weird behavior. > > ** ** > > Anyway, does somebody now how to solve the problem? > > ** ** > > And another question, after compiling (if I can make it J ), what files > (and where) will I need to include in the OSG Android example? > > ** ** > > Thank you. > > ** ** > > Cheers, > > ** ** > > Héctor > > ** ** > > *From:* osg-users-boun...@lists.openscenegraph.org [mailto: > osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *Mourad > Boufarguine > *Sent:* jueves, 11 de agosto de 2011 16:50 > > *To:* OpenSceneGraph Users > *Subject:* Re: [osg-users] OSG for Android > > ** ** > > ** ** > > On Thu, Aug 11, 2011 at 1:09 PM, Mourad Boufarguine < > mourad.boufargu...@gmail.com> wrote: > > Hi Hector, > > ** ** > > 2011/8/11 Héctor Martínez > > Thank you Mourad and Jorge. > > > > I have never used CygWin and I am trying to follow those instructions: > > > > > http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Cygwin > > > ** ** > > Those are for building OSG with cygwin to be used on a PC. > > > > > > But it is a bit messy for me. Mourad, it seems like you have successfully > compiled OSG for Android in Windows. Could you please give me a quick guide > or some tips? > > ** ** > > ** ** > > 1/ install Cygwin ^^ , make sure to install gcc , g++, make, ... (a full > install may be helpful). > > ** ** > > Please note that, although we won't be compiling osg with cygwin's g++ , it > needs to be installed in order for cmake to get over compiler checks at the > beginning of configuration. (and other packages may be also needed) > > ** ** > > 2/ in cmake gui, set the sources and binairies folders, hit configure and > choose "Unix Makefiles" as generator > > ** ** > > 3/ Check "OSG_BUILD_PLATFORM_ANDROID" and hit configure > > > > 4/ Set (if not set) ANDROID_NDK path > > ** ** > > 5/ Configure your build whether you want GLES1 or GLES2 following these > instructions : > http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES > > ** ** > > 6/ Configure and Generate > > ** ** > > 7/ open Cygwin batch, cd to binaires dir, and "make" > > ** ** > > > > Héctor > > > > ** ** > > Cheers, > > Mourad > > ** ** > > ** ** > > After re trying and checking, i found out that it is preferable to use the > command line cmake in cygwin rather than cmake gui : > > ** ** > > ** ** > > ** ** > > cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF > > -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF > > -DOSG_GL_MATRICES_AVAILABLE=ON -DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON > > -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON > -DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON > > -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF > -DOSG_GL2_AVAILABLE=OFF > > -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=ON -DOSG_GLES2_AVAILABLE=OFF > > Mourad > > ** ** > > ** ** > > ** ** > > ** ** > > ___ > 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] OSG for Android
Hi Riccardo, I have used the ndk-build command and (after long time J ) it has finished apparently without errors. The I have copied the files to the osgViewer project (under the obj folder). After that, I have tried to compile using ndk-build, and I got this error: Compile++ thumb : osgNativeLib <= osgNativeLib.cpp /bin/sh: -Itype: No such file or directory make: *** [/cygdrive/c/Projects/Eclipse/osgViewer/obj/local/armeabi/objs/osgNativeLib/ osgNativeLib.o] Error 1 Of course, there is no such file in that folder. I neither have been able to find that file in the OSG folder. So, maybe compilation has not worked correctly? Cheers Héctor From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Riccardo Corsi Sent: viernes, 12 de agosto de 2011 15:49 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android Hi Hector, maybe you can try to use the ndk-build command instead of "make", and see if it runs smooth. If so, probably there's something wrong with the makefile generated by CMake... Regarding the osg Android example, the folder structure is the same as the one of the NDK examples. Build instructions for native projects are very clear on the ndk online documentation, especially if you use Eclipse. You basically need to build the native part of the example before (under the jni folder) the same way you compiled the native osg libs, and afterwards build the java files under src. They make use of the native lib, and both the java code and the native library will be packed in the apk by Eclipse (or the compiler you're using). HTH, Ricky 2011/8/12 Héctor Martínez Hi and thank you. I first tried with the Cmake GUI, but I got some errors. After that, I have read your answer pointing to command line. I have used the cmake command line (not without some problems J ): cmake -> OK make -> Error: make[3]: *** [/cygdrive/c/Projects/OpensSceneGraph-3.0.1/OpenSceneGraph/obj/local/armeabi -v7a/objs/osgdb_serializers_osg/BlendEquation..o] Error 126 make[3]: *** Waiting for unfinished jobs . make[2]: *** [Android-OpenSceneGraph] Error 2 make[1]: *** [CMakeFiles/ndk.dir/all] Error 2 make: *** [all] Error 2 After that, I have tried to use make install and it has finished without error, but I think this is a weird behavior. Anyway, does somebody now how to solve the problem? And another question, after compiling (if I can make it J ), what files (and where) will I need to include in the OSG Android example? Thank you. Cheers, Héctor From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Mourad Boufarguine Sent: jueves, 11 de agosto de 2011 16:50 To: OpenSceneGraph Users Subject: Re: [osg-users] OSG for Android On Thu, Aug 11, 2011 at 1:09 PM, Mourad Boufarguine wrote: Hi Hector, 2011/8/11 Héctor Martínez Thank you Mourad and Jorge. I have never used CygWin and I am trying to follow those instructions: <http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/C ygwin> http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Cy gwin Those are for building OSG with cygwin to be used on a PC. But it is a bit messy for me. Mourad, it seems like you have successfully compiled OSG for Android in Windows. Could you please give me a quick guide or some tips? 1/ install Cygwin ^^ , make sure to install gcc , g++, make, ... (a full install may be helpful). Please note that, although we won't be compiling osg with cygwin's g++ , it needs to be installed in order for cmake to get over compiler checks at the beginning of configuration. (and other packages may be also needed) 2/ in cmake gui, set the sources and binairies folders, hit configure and choose "Unix Makefiles" as generator 3/ Check "OSG_BUILD_PLATFORM_ANDROID" and hit configure 4/ Set (if not set) ANDROID_NDK path 5/ Configure your build whether you want GLES1 or GLES2 following these instructions : http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES 6/ Configure and Generate 7/ open Cygwin batch, cd to binaires dir, and "make" Héctor Cheers, Mourad After re trying and checking, i found out that it is preferable to use the command line cmake in cygwin rather than cmake gui : cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DOSG_GL_MATRICES_AVAILABLE=ON -DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON -DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF -DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=ON -DOSG_GLES2_AVAILABLE=OFF Mourad _
Re: [osg-users] OSG for Android
Jorge Izquierdo Ciges wrote: > ... About the other things probably is just that you didn't do a make install > to create a directory with all the includes etc Hi, I also have some issues with the example, basically the same as Riccardo. I did run the make install on my OSG build and it went OK (everything was installed under /usr/local/). But running the build command on that Android.mk still does not find the header files, unless I explicitly add an entry to the LOCAL_C_INCLUDES to add the standard osg/include tree. No idea why it works for you and not for us... A question: did you create your Android build in a separate folder (in my case under the OSG root) or did you do in source. mixing the new stuff with what comes out of SVN? Now on to the next issue: linker... I get this error: Code: ld.exe: cannot find -losgdb_dds Of course that lib as well as all the others are present in my build tree (and I indicated it correctly in the Android.mk file). Any idea what could cause these issue? Last but not least, is everybody using the ndk-build command to compile the example? Or is there another solution maybe going through CMake? I'd like to make sure that I do the things I'm supposed to... Thanks, Luca -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42101#42101 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android
I usually install it in a separate directory because there's no point in installing it into system. It would be trouble with the standard linux installation on your system. I usually build it out of the OSG svn directory, i don't like mix svn and not svn things. And, of course last time I tested everything (about two weeks) all was running in thrunk. About linking, one again that's just an error of not finding the librarie. In that case is the dds plugin. It should not be any trouble if you set the path on the Android.mk (osgAndroidExampleGLES*/jni) Line:7 OSG_ANDROID_DIR := "type your install directory here" Which SETS both LOCAL_L_INCLUDES and LOCAL_LDFLAGS variables according to the the Target Architecture. And no, there are no other ways supplied. There are other ways to compile with NDK but require scripting and bypassing the usual ndk build. 2011/8/17 Luca Vezzadini > > Jorge Izquierdo Ciges wrote: > > ... About the other things probably is just that you didn't do a make > install to create a directory with all the includes etc > > Hi, > I also have some issues with the example, basically the same as Riccardo. I > did run the make install on my OSG build and it went OK (everything was > installed under /usr/local/). But running the build command on that > Android.mk still does not find the header files, unless I explicitly add an > entry to the LOCAL_C_INCLUDES to add the standard osg/include tree. No idea > why it works for you and not for us... A question: did you create your > Android build in a separate folder (in my case under the OSG root) or did > you do in source. mixing the new stuff with what comes out of SVN? > Now on to the next issue: linker... I get this error: > > Code: > ld.exe: cannot find -losgdb_dds > > > Of course that lib as well as all the others are present in my build tree > (and I indicated it correctly in the Android.mk file). Any idea what could > cause these issue? > > Last but not least, is everybody using the ndk-build command to compile the > example? Or is there another solution maybe going through CMake? I'd like to > make sure that I do the things I'm supposed to... > Thanks, > > Luca > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=42101#42101 > > > > > > ___ > 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] OSG for Android
Hi Jorge, So, that means that I am doing thing in the correct order. After some more test I found out the problem: it's something in Cygwin. If I use relative paths instead of absolute ones everything works fine. No idea why and I don't want to investigate further, but at least now I know it's a cygwin-specific thing... Thanks! Luca -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42106#42106 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG for Android on Mac
Hi, I am trying to build OSG for Android on Mac 10.6.7. I already get Eclipse, Android Plugin and CDT Plugin and also Android NDK. I configure the project with CMake and generate an Eclipse CDT4 project. After that, I create a new Android Project with "Create project from existing source" and add the generated Eclipse CDT4 project. Now, when I try to build this project, I get following error: > Conversion to Dalvik format failed with error 1 > Dx no classfiles specified Are my steps to compile OSG for Android false? Cheers, Büsra -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41997#41997 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG for Android with Necessitas?
Hi, i have recompiled OSG 3.0.1 for Android wint Ubuntu 11, and now i'm trying to compiled the osgviewerQT example under Windows, using Necessitas (QT Android porting). I have some problems with EGL initializations. I get eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS). Someone has been using Necessitas with OSG? Some tricks and tips? Thank you! Cheers, Massimo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47779#47779 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG for Android on Mac
Hi Busra, I'm not familiar with Mac dev environment, but I guess that you're trying to build osg with Eclipse CDT with the regular gcc compiler, which is targetting pc architecture. Instead you need to create a makefile suited for the ndk-build. The CMake options you need are fully detailed in the wiki page and in other threads of this mailing list. Good luck, Ricky 2011/8/11 Büsra Gülten > Hi, > > I am trying to build OSG for Android on Mac 10.6.7. I already get Eclipse, > Android Plugin and CDT Plugin and also Android NDK. > > I configure the project with CMake and generate an Eclipse CDT4 project. > After that, I create a new Android Project with "Create project from > existing source" and add the generated Eclipse CDT4 project. > Now, when I try to build this project, I get following error: > > > > Conversion to Dalvik format failed with error 1 > > Dx no classfiles specified > > > Are my steps to compile OSG for Android false? > > Cheers, > Büsra > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=41997#41997 > > > > > > ___ > 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] OSG for android cube texture problem
Hello everyone:I got a cube texture problem in my program base on ES2.0. The texture is black, does anyone know what is the problem.Here is my shader code: *Vertex shader * varying vec3 Normal; varying vec3 EyeDir; uniform samplerCube cubeMap; void main() { gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; Normal = gl_NormalMatrix * gl_Normal; EyeDir = vec3(gl_ModelViewMatrix * gl_Vertex); } *Fragment shader * varying vec3 Normal; varying vec3 EyeDir; uniform samplerCube cubeMap; void main(void) { vec3 reflectedDirection = normalize(reflect(EyeDir, normalize(Normal))); reflectedDirection.y = -reflectedDirection.y; vec4 fragColor = textureCube(cubeMap, reflectedDirection); gl_FragColor = fragColor; } Here is my osg code: void CSkyBox::setSkyBoxRadius(osg::Vec3 centre, double r) { m_centre=centre; m_r=r; } osg::TextureCubeMap* CSkyBox::readCubeMap(osg::Image* imagePosX, osg::Image* imageNegX, osg::Image* imagePosY, osg::Image* imageNegY, osg::Image* imagePosZ, osg::Image* imageNegZ) { osg::TextureCubeMap* cubemap = NULL; if (imagePosX && imageNegX && imagePosY && imageNegY && imagePosZ && imageNegZ) { cubemap = new osg::TextureCubeMap; cubemap->setImage(osg::TextureCubeMap::POSITIVE_X, imagePosX); cubemap->setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX); cubemap->setImage(osg::TextureCubeMap::POSITIVE_Y, imagePosY); cubemap->setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY); cubemap->setImage(osg::TextureCubeMap::POSITIVE_Z, imagePosZ); cubemap->setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ); cubemap->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); cubemap->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); cubemap->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE); cubemap->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR); cubemap->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); } return cubemap; } osg::TextureCubeMap* CSkyBox::readCubeMap() { std::string path=getImagesPath(); osg::Image* imagePosX = osgDB::readImageFile(path+"\\posx.jpg"); osg::Image* imageNegX = osgDB::readImageFile(path+"\\negx.jpg"); osg::Image* imagePosY = osgDB::readImageFile(path+"\\posy.jpg"); osg::Image* imageNegY = osgDB::readImageFile(path+"\\negy.jpg"); osg::Image* imagePosZ = osgDB::readImageFile(path+"\\posz.jpg"); osg::Image* imageNegZ = osgDB::readImageFile(path+"\\negz.jpg"); return readCubeMap(imagePosX, imageNegX, imagePosY, imageNegY, imagePosZ, imageNegZ); } struct TexMatCallback : public osg::NodeCallback { public: TexMatCallback(osg::TexMat& tm) : _texMat(tm) { } virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osgUtil::CullVisitor* cv = dynamic_cast(nv); if (cv) { const osg::Matrix& MV = *(cv->getModelViewMatrix()); const osg::Matrix R = osg::Matrix::rotate( osg::DegreesToRadians(112.0f), 0.0f,0.0f,1.0f)* osg::Matrix::rotate( osg::DegreesToRadians(90.0f), 1.0f,0.0f,0.0f); osg::Quat q = MV.getRotate(); const osg::Matrix C = osg::Matrix::rotate( q.inverse() ); _texMat.setMatrix( C*R ); } traverse(node,nv); } osg::TexMat& _texMat; }; class MoveEarthySkyWithEyePointTransform : public osg::Transform { public: /** Get the transformation matrix which moves from local coords to world coords.*/ virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const { osgUtil::CullVisitor* cv = dynamic_cast(nv); if (cv) { osg::Vec3 eyePointLocal = cv->getEyeLocal(); matrix.preMult(osg::Matrix::translate(eyePointLocal)); } return true; } /** Get the transformation matrix which moves from world coords to local coords.*/ virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const { osgUtil::CullVisitor* cv = dynamic_cast(nv); if (cv) { osg::Vec3 eyePointLocal = cv->getEyeLocal(); matrix.postMult(osg::Matrix::translate(-eyePointLocal)); } return true; } }; osg::Node* CSkyBox::createSkyBoxWithTextureCubeMap(osg::TextureCubeMap* skymap) { osg::StateSet* stateset = new osg::StateSet(); osg::TexMat *tm = new osg::TexMat; stateset->setTextureAttribute(0, tm); if (skymap) { stateset->setDataVariance(osg::Object::DYNAMIC); osg::ref_ptr skyProgram = new osg::Program; osg::Shader* vertex_shader = new osg::Shader(osg::Shader::VERTEX,skybox_vert); skyProgram->addShader(vertex_shader); osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT,skybox_frag); skyProgram->addShader(fragment_shader); stateset->addUniform(new osg::Uniform("uEnvironmentMap",0)); stateset->setAttributeAndModes(skyProgram); stateset->setTextureAttribute(0,skymap); } //stateset->setTextureAttributeAndModes(0, skymap, osg::StateAttribute::ON); stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); stateset->setMode( GL_CULL_FACE, osg::StateAttribute::OFF ); // clear the depth to the far plane. osg::Depth* depth = new osg::Depth; depth->setFunction(osg::Depth::ALWAYS); depth->setRange(1.0,1.0); stateset->setAttributeAndModes(depth, osg::StateA