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 <Emgui.h>
#include <GFXBackend.h> #include <GFXBackend.h>
NSOpenGLContext* g_context = 0;
@implementation RocketView @implementation RocketView
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -21,9 +23,18 @@
if (self == nil) if (self == nil)
return 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]; [oglContext makeCurrentContext];
g_context = oglContext;
EMGFXBackend_create(); EMGFXBackend_create();
Editor_create(); Editor_create();
@ -167,3 +178,9 @@
@end @end
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
void swapBuffers()
{
[g_context flushBuffer];
}