Horde3D

Next-Generation Graphics Engine
It is currently 19.04.2024, 03:24

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: H3D in a CAOpenGLLayer
PostPosted: 19.01.2012, 08:02 
Offline

Joined: 12.10.2010, 10:42
Posts: 5
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.


Top
 Profile  
Reply with quote  
PostPosted: 25.01.2012, 05:44 
Offline

Joined: 12.10.2010, 10:42
Posts: 5
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.


Top
 Profile  
Reply with quote  
PostPosted: 25.01.2012, 06:11 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 52 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group