Re: [osg-users] OpengGLES build failed

2010-08-27 Thread Rutton Rankin
Hi,
me too, Android.

I have a completely compiling OSG build for Android (as static library only). I 
have did some mods to OpenThreads (rough... ;-), the buildsystem here and there 
and added some guarded includes for Android. Even osgViewer seems to compile 
just fine (I use GraphicsWindowEmbedded as dummy implementation).

What is missing now is the connection between Android-Java and OSG.
I will explain first how GL-Setup and Rendering is done with Android.
The first steps are always done with Java, as the native kit does not support 
EGL or any other window handling. It is just able to do raw openGL ES calls 
(what khronos headers provide).
Well, in the Android-Java-Environment, a GLSurfaceView ist created, which 
creates an EGLContext. Then, a GLSurfaceView.Renderer is attached to this 
GLSurfaceView. The renderer is called in a thread-loop (in the JVM) and draws a 
single frame with each call. These calls can then call (via JNI) native 
implementations for drawing with a native openGL-lib.

And thats what I need now, a way to manually request a drawing-operation for a 
scene. I would start with one scene first, and see how that could work. What I 
understand of osg is, that it provides always at least one thread to do all the 
work (Threading-Model Singlethreaded as simplest example). Here, I have to 
provide a way, to remove the actual drawing request (but still doing event 
handling seems fine) and offer some way for the JVM-Render-Thread to execute 
the rendering for a single frame (of the scene).
I believe, the needed modifications can be done in osgViewer, but I don't 
really understand how osg starts to render a single frame, e.g. which class 
calls which class (especially which class is the root for starting off to 
render a frame). Okay, I will do some more rtfs, but perhaps someone can 
enlighten me and give me some hints on how to do it the best way. 

Cheers,
Rutton

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





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


Re: [osg-users] OpengGLES build failed

2010-08-27 Thread Robert Osfield
Hi Rutton,

I'm not familiar with Andriod programming so can't help with the
platform specifics, I'll try an make what suggests I can though.

If you have a EGL context already then as you've picked up using
osgViewer with GraphicsWindowEmbedded is the way forward.  The
osgviewerGLUT and osgviewerSDL examples illustrate how this can be
done.   As you will see from these examples a viewer.frame(); called
when you want to render each new frame.

This viewer.frame() method itself calls viewer.advance() to move the
FrameStamp on one frame.  The FrameStamp is used to synchronize all
the updates and rendering so that all objects have the same reference
and simulation time for that particular frame.  Next the
viewer.eventTraversal() is run which updates any CameraManipulator and
EventHandler attached to the viewer.  Next the
viewer.updateTraversal() is called to animation any objects in the
scene.  Finally viewer.renderingTraversals() is called that
coordinates the running of the cull and draw traversals.

For your usage just calling viewer.frame() will probably be appropriate.

Robert.

On Thu, Aug 26, 2010 at 10:50 PM, Rutton Rankin rut...@web.de wrote:
 Hi,
 me too, Android.

 I have a completely compiling OSG build for Android (as static library only). 
 I have did some mods to OpenThreads (rough... ;-), the buildsystem here and 
 there and added some guarded includes for Android. Even osgViewer seems to 
 compile just fine (I use GraphicsWindowEmbedded as dummy implementation).

 What is missing now is the connection between Android-Java and OSG.
 I will explain first how GL-Setup and Rendering is done with Android.
 The first steps are always done with Java, as the native kit does not support 
 EGL or any other window handling. It is just able to do raw openGL ES calls 
 (what khronos headers provide).
 Well, in the Android-Java-Environment, a GLSurfaceView ist created, which 
 creates an EGLContext. Then, a GLSurfaceView.Renderer is attached to this 
 GLSurfaceView. The renderer is called in a thread-loop (in the JVM) and draws 
 a single frame with each call. These calls can then call (via JNI) native 
 implementations for drawing with a native openGL-lib.

 And thats what I need now, a way to manually request a drawing-operation for 
 a scene. I would start with one scene first, and see how that could work. 
 What I understand of osg is, that it provides always at least one thread to 
 do all the work (Threading-Model Singlethreaded as simplest example). Here, I 
 have to provide a way, to remove the actual drawing request (but still doing 
 event handling seems fine) and offer some way for the JVM-Render-Thread to 
 execute the rendering for a single frame (of the scene).
 I believe, the needed modifications can be done in osgViewer, but I don't 
 really understand how osg starts to render a single frame, e.g. which class 
 calls which class (especially which class is the root for starting off to 
 render a frame). Okay, I will do some more rtfs, but perhaps someone can 
 enlighten me and give me some hints on how to do it the best way.

 Cheers,
 Rutton

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





 ___
 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] OpengGLES build failed

2010-08-27 Thread Rutton Rankin
Hello folks,

I will try that and report back my results on Android. I already read something 
after my post last night about osg::Viewer::frame somewhere. I love 
inheritance, it can make things really powerful.

Thank you!

Cheers,
Rutton

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





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


Re: [osg-users] OpengGLES build failed

2010-08-19 Thread Robert Osfield
Hi Rafam

I have Android phone so am curious about how well you'll get on, I
haven't actually attempted any port - way too many other tasks on my
plate to tinker.

On Wed, Aug 18, 2010 at 7:59 PM, Rafa Gaitan rafa.gai...@gmail.com wrote:
 /Users/rgaitan/Projects/OSG/osg-trunk/src/osg/Texture.cpp: In member
 function 'void osg::Texture::applyTexImage2D_load(osg::State, GLenum,
 const osg::Image*, GLsizei, GLsizei, GLsizei) const':
 /Users/rgaitan/Projects/OSG/osg-trunk/src/osg/Texture.cpp:1600: error:
 'GL_RED' was not declared in this scope.

 I'm not sure how to achieve the change, maybe adding and #ifdef and
 checking if GLES/GLES2 is active? The other changes I have are only to
 allow ndk gcc compiler build correctly so they are minor changes, but
 the change on Texture.cpp affects functionality and I'm not sure which
 is the better way to achieve it. Once I have things working I will
 post on osg-submission the changes ;)

You could just add a

   #ifndef GL_RED
  #define GL_RED 0x1903
   #endif

To get the code to compile.  It won't do anything as the extension
code paths won't be visited, this is the approach I've previously been
using to minimize the number of code differences between platforms.

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


Re: [osg-users] OpengGLES build failed

2010-08-19 Thread Rafa Gaitan
Hi Robert,

2010/8/19 Robert Osfield robert.osfi...@gmail.com:
 Hi Rafam

 I have Android phone so am curious about how well you'll get on, I
 haven't actually attempted any port - way too many other tasks on my
 plate to tinker.

We have some projects that will make use of 3D in mobile systems, and
we are experimenting with Android as first platform. IPhone is also
interesting but distribution method of software is a little bit
complicated so we are testing first Android. I hope have some results
in a few weeks.


 On Wed, Aug 18, 2010 at 7:59 PM, Rafa Gaitan rafa.gai...@gmail.com wrote:
 /Users/rgaitan/Projects/OSG/osg-trunk/src/osg/Texture.cpp: In member
 function 'void osg::Texture::applyTexImage2D_load(osg::State, GLenum,
 const osg::Image*, GLsizei, GLsizei, GLsizei) const':
 /Users/rgaitan/Projects/OSG/osg-trunk/src/osg/Texture.cpp:1600: error:
 'GL_RED' was not declared in this scope.

 I'm not sure how to achieve the change, maybe adding and #ifdef and
 checking if GLES/GLES2 is active? The other changes I have are only to
 allow ndk gcc compiler build correctly so they are minor changes, but
 the change on Texture.cpp affects functionality and I'm not sure which
 is the better way to achieve it. Once I have things working I will
 post on osg-submission the changes ;)

 You could just add a

   #ifndef GL_RED
      #define GL_RED 0x1903
   #endif

 To get the code to compile.  It won't do anything as the extension
 code paths won't be visited, this is the approach I've previously been
 using to minimize the number of code differences between platforms.

Ok, I will do that! Thank you!

Rafa.




-- 
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] OpengGLES build failed

2010-08-18 Thread Jason Daly

Rafa Gaitan wrote:

Hi Robert,

I'm trying to build OSG with the android ndk (android-ndk-r4-crystax).
 I have made some changes in the code to allow the build, but I think
recent changes in Texture.cpp have broken the build against
GLES/GLES2.

/Users/rgaitan/Projects/OSG/osg-trunk/src/osg/Texture.cpp: In member
function 'void osg::Texture::applyTexImage2D_load(osg::State, GLenum,
const osg::Image*, GLsizei, GLsizei, GLsizei) const':
/Users/rgaitan/Projects/OSG/osg-trunk/src/osg/Texture.cpp:1600: error:
'GL_RED' was not declared in this scope.

I'm not sure how to achieve the change, maybe adding and #ifdef and
checking if GLES/GLES2 is active? The other changes I have are only to
allow ndk gcc compiler build correctly so they are minor changes, but
the change on Texture.cpp affects functionality and I'm not sure which
is the better way to achieve it. Once I have things working I will
post on osg-submission the changes ;)
  


Hi, Rafa,

Great to hear someone is working on Android!

Just curious, how are you handling osgViewer?  I tried to get an Android 
NDK build going with the crystax version as well, but I ran into a brick 
wall as soon as I got past osgUtil.  I didn't have time to try and work 
through it, so I had to give up.


--J

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


Re: [osg-users] OpengGLES build failed

2010-08-18 Thread Rafa Gaitan
Hi Jason,


 Hi, Rafa,

 Great to hear someone is working on Android!

 Just curious, how are you handling osgViewer?  I tried to get an Android NDK
 build going with the crystax version as well, but I ran into a brick wall as
 soon as I got past osgUtil.  I didn't have time to try and work through it,
 so I had to give up.

My first approach is trying to get all built, I've made some changes
into CMake for osgViewer, to not build if the system is not supported.
I know is not the best approach, but I thing that using
GraphicsWindowsEmbedded and using android sdk/ndk to create the
graphics context is a first and quick way to test if things work on
Android.

Tthis approach works in Java with gvSIG 3D and osgVirtualPlanets, so I
hope will also work on Android! :).

Rafa.


 --J

 ___
 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] OpengGLES build failed

2010-08-18 Thread Jason Daly

Rafa Gaitan wrote:

My first approach is trying to get all built, I've made some changes
into CMake for osgViewer, to not build if the system is not supported.
I know is not the best approach, but I thing that using
GraphicsWindowsEmbedded and using android sdk/ndk to create the
graphics context is a first and quick way to test if things work on
Android.

Tthis approach works in Java with gvSIG 3D and osgVirtualPlanets, so I
hope will also work on Android! :).
  


Yeah, that makes sense.  Looking forward to it!

--J

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