Now using DoubleBuffered rendering under OS X for OpenGL. Should hopefully gives some perf gain

This commit is contained in:
Daniel Collin 2012-11-23 23:03:26 +01:00
parent 990ae399a1
commit e65e4f992f

View File

@ -4,6 +4,8 @@
#include <Emgui.h>
#include <GFXBackend.h>
NSOpenGLContext* g_context = 0;
@implementation RocketView
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -20,10 +22,19 @@
self = [super initWithFrame:frame];
if (self == nil)
return nil;
oglContext = [[NSOpenGLContext alloc] initWithFormat: [NSOpenGLView defaultPixelFormat] shareContext: nil];
NSOpenGLPixelFormatAttribute attributes[4];
attributes[0] = NSOpenGLPFADoubleBuffer;
attributes[1] = 0;
NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
oglContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil];
//oglContext = [[NSOpenGLContext alloc] initWithFormat: [NSOpenGLView defaultPixelFormat] shareContext: nil];
[oglContext makeCurrentContext];
g_context = oglContext;
EMGFXBackend_create();
Editor_create();
@ -167,3 +178,9 @@
@end
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
void swapBuffers()
{
[g_context flushBuffer];
}