mirror of https://github.com/bkaradzic/bgfx
Cleanup.
This commit is contained in:
parent
9852949a38
commit
41dfddf424
|
@ -96,19 +96,13 @@ using namespace entry;
|
|||
|
||||
@interface EAGLView : UIView
|
||||
{
|
||||
|
||||
EAGLContext* m_context;
|
||||
CADisplayLink* m_displayLink;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) EAGLContext* m_context;
|
||||
|
||||
@end
|
||||
|
||||
@implementation EAGLView
|
||||
|
||||
@synthesize m_context;
|
||||
|
||||
+ (Class)layerClass
|
||||
{
|
||||
return [CAEAGLLayer class];
|
||||
|
@ -124,22 +118,7 @@ using namespace entry;
|
|||
}
|
||||
|
||||
CAEAGLLayer* layer = (CAEAGLLayer*)self.layer;
|
||||
layer.opaque = true;
|
||||
|
||||
layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys
|
||||
: [NSNumber numberWithBool:false]
|
||||
, kEAGLDrawablePropertyRetainedBacking
|
||||
, kEAGLColorFormatRGBA8
|
||||
, kEAGLDrawablePropertyColorFormat
|
||||
, nil
|
||||
];
|
||||
|
||||
m_context = [ [EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
BX_CHECK(NULL != m_context, "Failed to create kEAGLRenderingAPIOpenGLES2 context.");
|
||||
|
||||
[EAGLContext setCurrentContext:m_context];
|
||||
|
||||
bgfx::iosSetEaglContext(m_context, layer);
|
||||
bgfx::iosSetEaglLayer(layer);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace bgfx
|
|||
#elif BX_PLATFORM_IOS
|
||||
namespace bgfx
|
||||
{
|
||||
void iosSetEaglContext(void* _context, void* _layer);
|
||||
void iosSetEaglLayer(void* _layer);
|
||||
} // namespace bgfx
|
||||
|
||||
#elif BX_PLATFORM_LINUX
|
||||
|
|
|
@ -40,11 +40,9 @@ namespace bgfx
|
|||
g_bgfxAndroidWindow = _window;
|
||||
}
|
||||
#elif BX_PLATFORM_IOS
|
||||
void* g_bgfxEaglContext = NULL;
|
||||
void* g_bgfxEaglLayer = NULL;
|
||||
void iosSetEaglContext(void* _context, void* _layer)
|
||||
void iosSetEaglLayer(void* _layer)
|
||||
{
|
||||
g_bgfxEaglContext = _context;
|
||||
g_bgfxEaglLayer = _layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ namespace bgfx
|
|||
#if BX_PLATFORM_ANDROID
|
||||
extern ::ANativeWindow* g_bgfxAndroidWindow;
|
||||
#elif BX_PLATFORM_IOS
|
||||
extern void* g_bgfxEaglContext;
|
||||
extern void* g_bgfxEaglLayer;
|
||||
#elif BX_PLATFORM_OSX
|
||||
extern void* g_bgfxNSWindow;
|
||||
|
|
|
@ -14,11 +14,21 @@ namespace bgfx
|
|||
{
|
||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
EAGLContext* context = (EAGLContext*)g_bgfxEaglContext;
|
||||
CAEAGLLayer* layer = (CAEAGLLayer*)g_bgfxEaglLayer;
|
||||
[EAGLContext setCurrentContext:context];
|
||||
layer.opaque = true;
|
||||
|
||||
m_context = g_bgfxEaglContext;
|
||||
layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys
|
||||
: [NSNumber numberWithBool:false]
|
||||
, kEAGLDrawablePropertyRetainedBacking
|
||||
, kEAGLColorFormatRGBA8
|
||||
, kEAGLDrawablePropertyColorFormat
|
||||
, nil
|
||||
];
|
||||
|
||||
EAGLContext* context = [ [EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
BX_CHECK(NULL != context, "Failed to create kEAGLRenderingAPIOpenGLES2 context.");
|
||||
m_context = (void*)context;
|
||||
[EAGLContext setCurrentContext:context];
|
||||
|
||||
GL_CHECK(glGenFramebuffers(1, &m_fbo) );
|
||||
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) );
|
||||
|
|
Loading…
Reference in New Issue