Horde3D http://www.horde3d.org/forums/ |
|
H3D in a CAOpenGLLayer http://www.horde3d.org/forums/viewtopic.php?f=2&t=1628 |
Page 1 of 1 |
Author: | tollund7 [ 19.01.2012, 08:02 ] |
Post subject: | H3D in a CAOpenGLLayer |
Hi, I put Horde into an NSOpenGLView as suggested in the thread at viewtopic.php?f=2&t=115. I then tried to implement something similar in a subclass of a CAOpenGLLayer. I don't seem to be able to get it rendering properly, I was wondering if you guys had any ideas/samples of such a thing? I put a sample up which supports both methods; there is a flag in AppDelegate.mm to switch between rendering modes. The pipeline resource is set up to just clear the target to red. You'll notice that using CoreAnimation just leaves a blank canvas. I think it has something to do with not having set up double-buffering properly. If you guys have any hints it would be much appreciated, thanks. |
Author: | tollund7 [ 25.01.2012, 05:44 ] |
Post subject: | Re: H3D in a CAOpenGLLayer |
Turns out the layer was not opaque by default, so after setting opaque to 'YES' things started showing. Something else that was a bit suspicious; after a few renders h3dRender() hung at glDrawRangeElements(), which was being called from CAOpenGLLayer.drawInCGLContext(). A bit of debugging reveals that the CGLPixelFormat is getting recreated after a few renders. After hacking it a bit and delaying horde initialisation and rendering until the secend CGLPixelFormat has been set, every works fine. i.e. something like: Code: @implementation someCAOpenGLLayerSubclass // ... -(void)drawInCGLContext:(CGLContextObj)ctx pixelFormat:(CGLPixelFormatObj)pf forLayerTime:(CFTimeInterval)t displayTime:(const CVTimeStamp *)ts { // the pf parameter is changed after the first few calls if(_initialPF) { _initialPF = (long)(void*)pf; } else if(initialFormat != (long)(void*)pf) { // do horde stuff if the pixel format has been re-created } [super drawInCGLContext:ctx pixelFormat:pf forLayerTime:t displayTime:ts]; } For now, I'll just move horde init and cleanup to the overrides for creating/destroying pixel formats. |
Author: | Volker [ 25.01.2012, 06:11 ] |
Post subject: | Re: H3D in a CAOpenGLLayer |
Thanks for the feedback. Unfortunately neither marciano nor I do have a mac so we aren't very familiar with the platform's specific issues. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |