Re: [osg-users] FBOs and iOS (iPad/iPhone)

2010-11-20 Thread Stephan Huber
Hi Tom,

Am 20.11.10 18:02, schrieb Thomas Hogarth:
 Hi Stephan
 
 I've got round to looking at the new changes, I've got one altered CMake
 file (root one) just needed to default the windowing system to IOS. Other
 issue is that I'm getting a crash on line 1056 of RenderStage.cpp. Think the
 graphicsContext is null or something. I'll have a play but could you send me
 your test app incase i'm missing something.

I submitted a bugfix for this crash on 11-19-10, any chance you updated
your working-copy earlier?

https://github.com/stmh/osg/commit/51c6f49c1811f11d7ce032e74008fc70ea2165d6

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


Re: [osg-users] FBOs and iOS (iPad/iPhone)

2010-11-20 Thread Thomas Hogarth
Hi Stephan

Sweet, yeah checked mine out on the 117th/18th soI'll give it a whirl now.

Cheers
Tom

On 20 November 2010 17:14, Stephan Huber ratzf...@digitalmind.de wrote:

 Hi Tom,

 Am 20.11.10 18:02, schrieb Thomas Hogarth:
  Hi Stephan
 
  I've got round to looking at the new changes, I've got one altered CMake
  file (root one) just needed to default the windowing system to IOS. Other
  issue is that I'm getting a crash on line 1056 of RenderStage.cpp. Think
 the
  graphicsContext is null or something. I'll have a play but could you send
 me
  your test app incase i'm missing something.

 I submitted a bugfix for this crash on 11-19-10, any chance you updated
 your working-copy earlier?

 https://github.com/stmh/osg/commit/51c6f49c1811f11d7ce032e74008fc70ea2165d6

 cheers,
 Stephan

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


Re: [osg-users] FBOs and iOS (iPad/iPhone)

2010-11-20 Thread Thomas Hogarth
Hi Stephan,

Bingo, all looks good, great work mate. So I understand you are sending the
changes to Robert to be merged into the main osg branch. Sweet, if only you
lived near by, we could have a celebration drink :)

Cheers
Tom

On 20 November 2010 17:15, Thomas Hogarth thomas.hoga...@gmail.com wrote:

 Hi Stephan

 Sweet, yeah checked mine out on the 117th/18th soI'll give it a whirl now.

 Cheers
 Tom


 On 20 November 2010 17:14, Stephan Huber ratzf...@digitalmind.de wrote:

 Hi Tom,

 Am 20.11.10 18:02, schrieb Thomas Hogarth:
  Hi Stephan
 
  I've got round to looking at the new changes, I've got one altered CMake
  file (root one) just needed to default the windowing system to IOS.
 Other
  issue is that I'm getting a crash on line 1056 of RenderStage.cpp. Think
 the
  graphicsContext is null or something. I'll have a play but could you
 send me
  your test app incase i'm missing something.

 I submitted a bugfix for this crash on 11-19-10, any chance you updated
 your working-copy earlier?


 https://github.com/stmh/osg/commit/51c6f49c1811f11d7ce032e74008fc70ea2165d6

 cheers,
 Stephan



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


Re: [osg-users] FBOs and iOS (iPad/iPhone) (was: Re: OSGs OpenGLES 2.0 status)

2010-11-17 Thread Robert Osfield
Hi Guys,

I note that you have been using the name IPhone in naming of the
GraphicsWindowIPhone, now that Apple have generalised the iPhone OS to
be iOS, I would suggest changing the names of the various
methods/classes/files to reflect the name iOS rather than iPhone.

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


Re: [osg-users] FBOs and iOS (iPad/iPhone)

2010-11-17 Thread Stephan Huber
Hi Robert,

Am 17.11.10 10:00, schrieb Robert Osfield:

 I note that you have been using the name IPhone in naming of the
 GraphicsWindowIPhone, now that Apple have generalised the iPhone OS to
 be iOS, I would suggest changing the names of the various
 methods/classes/files to reflect the name iOS rather than iPhone.

Yeah, this code is still from days, where no other iOS devices were
known. Apple is using the Term IPHONE for their conditional defines,
too. But you are right, I'll refactor the code/files.

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


[osg-users] FBOs and iOS (iPad/iPhone) (was: Re: OSGs OpenGLES 2.0 status)

2010-11-16 Thread Stephan Maximilian Huber
Hi Thomas, hi Robert,

I did some more tests on the fbo-issue and I got it working on my side,
but the fix is hackyish and not ready for primetime.

The underlying issue is the following:

on the iphone all rendering goes into a bunch of FBOs, when you want to
swap buffers (there are no implicit buffers, only FBOs to my
understanding) you tell the system to blit the FrameBufferObjects to the
screen.

So I added a static setter for the standard fbo-id to switch back after
rendering into an osg-fbo. I set this to the fbo-id which is used for
rendering (usually 1, 2 if you had enabled MSAA) when creating a window
and its fbos inside GraphicsWindowIPhone.

But this approach will not work with multiple contexts, as every context
has its own set of fbos needed for rendering.

So what's your opinion to tackle this issue? Another virtual method
inside GraphicsWindow? Something like

virtual void osg::GraphicsWindow::unbindFbos() {}

where GraphicsWindowIphone override this method and bind its fbo-ids again?

Or is there a better approach?

I checked my hacky changes into the git-repository. Have a look here:
https://github.com/stmh/osg/commit/ffc18a791105477b2a38b5d09cf8c2e905f88e03

It makes no difference on the device vs. the simulator.

cheers,

Stephan


Am 04.11.10 15:06, schrieb Thomas Hogarth:
 I occurs on the hardware,I haven't tried the emulator yet as it takes so
 long to build everything :( (Stephan, do you have the emulator running at
 the mo). I got suspicious when I noticed the rtt fbo id was 2, after a
 little reading it became clear this issue had tripped a few people up.
 
 In terms of fixing it with a define, where would you feel the best place for
 the define is as the 0 id is used in FrameBufferObject.cpp and
 RenderStage.cpp. The reason I ask is that you need to #include
 TargetConditionals.h to determine we are on the IOS platform and this is
 already done in GL header. So I was wondering if perhaps I should put it
 into GL header.
 
 On a slightly different note. I'm starting to feel the need for an
 OSG_TARGET_PLATFORM or something similar. As we do more gles platforms I
 think determining the platform we are building for is going to become more
 difficult and at the moment it can be a problem for things like IPhone as
 CMake and XCode may just think we are building for OSX, since thats the
 platform we are on. An OSG_TARGET_PLATFORM define would give us a one stop
 shop for that information.
 
 
 Cheers
 Tom
 
 On 4 November 2010 09:29, Robert Osfield robert.osfi...@gmail.com wrote:
 
 Hi Thomas,

 Interesting investigation and fix.  Does this issue occur on the
 target hardware and software emulators of it?

 Robert.

 On Thu, Nov 4, 2010 at 5:56 AM, Thomas Hogarth
 thomas.hoga...@googlemail.com wrote:
 Fixed it,

 So after a bit of thinking I realised that the default buffer must be re
 binded at some point so did another search and found 3 calls to

 fbo_ext-glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);

 And my earlier hunch was correct that ios' default buffer id is actually
 1
 so changing to the below makes it work

 fbo_ext-glBindFramebuffer(GL_FRAMEBUFFER_EXT, 1);

 So now I need to add a DEFAULT_FRAMEBUFFER define or something in the
 FrameBufferObject header file that is set it to 1 on ios

 Over all though, good news. Performance seems great too.

 Tom

 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] FBOs and iOS (iPad/iPhone) (was: Re: OSGs OpenGLES 2.0 status)

2010-11-16 Thread Robert Osfield
HI Stephan,

On Tue, Nov 16, 2010 at 4:12 PM, Stephan Maximilian Huber
ratzf...@digitalmind.de wrote:
 So what's your opinion to tackle this issue? Another virtual method
 inside GraphicsWindow? Something like

 virtual void osg::GraphicsWindow::unbindFbos() {}

 where GraphicsWindowIphone override this method and bind its fbo-ids again?

 Or is there a better approach?

I sounds a bit like the issue that the OSG's rendering backend has to
deal with when managing pbuffers that are used for rendering to
texture.  The rendering backend has to releaseContext() on the window,
then makeCurrent() on the pbuffer, do the work, then do
releaseContext() on the bpuffer, then makeCurrent() on the window.

Now makeCurrent() and releaseContext() have specific meaning w.r.t
contexts, but perhaps this same meaning could be confered to the iOS
GraphicsWindow w.r.t fbo's.  It isn't quite the same though... with
iOS it'd still be the same context and sharing all the same GL objects
virtue of being the same context.

I wonder if the FBO Id for the iOS GraphicsContext could be stored in
the GraphicsContext and when it's non zero have rendering backend pick
up on the fact that the GraphicsContext isn't an ordinary graphics
context but really just a FBO and then have the rendering backend use
the FBO id to re-enabling it after rendering to the RTT FBO's.

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


Re: [osg-users] FBOs and iOS (iPad/iPhone)

2010-11-16 Thread Stephan Huber
Hi Robert,

Am 16.11.10 17:51, schrieb Robert Osfield:
 I wonder if the FBO Id for the iOS GraphicsContext could be stored in
 the GraphicsContext and when it's non zero have rendering backend pick
 up on the fact that the GraphicsContext isn't an ordinary graphics
 context but really just a FBO and then have the rendering backend use
 the FBO id to re-enabling it after rendering to the RTT FBO's.
 
 Thoughts?

Sounds like a good solution for the problem and it will work with
multiple contexts. I'll implement it and report back/ send it to
osg-submission.

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


Re: [osg-users] FBOs and iOS (iPad/iPhone) (was: Re: OSGs OpenGLES 2.0 status)

2010-11-16 Thread Thomas Hogarth
Hi Guys

This sounds great, one question Stephan, does your approach also fix the
problem I was having with having to setup any RTT after the ios view has
been created (i.e. after the first frame)?

I'll check this all out tommorw and try and have a big test session, I've
got an IPod touch 2nd and 4th gen. 2nd gen is running 3.2 and 4th gen
running 4.1. Perhaps if all is well we can start a list of features and
devices and get everything ticked off. Maybe stick it on the wikki (how do I
get edit acces to that?)

Big thanks for all the efforts guys, soon I'll be able to start having some
real fun deving some games with this :)


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


Re: [osg-users] FBOs and iOS (iPad/iPhone) (was: Re: OSGs OpenGLES 2.0 status)

2010-11-16 Thread Thomas Hogarth
Hi Stephan

One last thing that need adding to the IPhone Graphics window is the re
definitions for the gles2 frame buffer functions, essentially they just drop
the OES part. My file is attached, ignore anything other than the defines at
the top

Cheers
Tom

On 16 November 2010 21:37, Thomas Hogarth thomas.hoga...@googlemail.comwrote:

 Hi Guys

 This sounds great, one question Stephan, does your approach also fix the
 problem I was having with having to setup any RTT after the ios view has
 been created (i.e. after the first frame)?

 I'll check this all out tommorw and try and have a big test session, I've
 got an IPod touch 2nd and 4th gen. 2nd gen is running 3.2 and 4th gen
 running 4.1. Perhaps if all is well we can start a list of features and
 devices and get everything ticked off. Maybe stick it on the wikki (how do I
 get edit acces to that?)

 Big thanks for all the efforts guys, soon I'll be able to start having some
 real fun deving some games with this :)


 Cheers
 Tom



GraphicsWindowIPhone.mm
Description: Binary data
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org