AGL: small style fixes
This commit is contained in:
parent
4770e66811
commit
c63925dc21
|
@ -15,10 +15,6 @@ struct NSView;
|
||||||
|
|
||||||
class cInterfaceAGL : public cInterfaceBase
|
class cInterfaceAGL : public cInterfaceBase
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
NSView* cocoaWin;
|
|
||||||
NSOpenGLContext* cocoaCtx;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Swap() override;
|
void Swap() override;
|
||||||
bool Create(void* window_handle, bool core) override;
|
bool Create(void* window_handle, bool core) override;
|
||||||
|
@ -27,4 +23,8 @@ public:
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
void Update() override;
|
void Update() override;
|
||||||
void SwapInterval(int interval) override;
|
void SwapInterval(int interval) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
NSView* m_view;
|
||||||
|
NSOpenGLContext* m_context;
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,7 @@ static bool AttachContextToView(NSOpenGLContext* context, NSView* view, u32* wid
|
||||||
|
|
||||||
void cInterfaceAGL::Swap()
|
void cInterfaceAGL::Swap()
|
||||||
{
|
{
|
||||||
[cocoaCtx flushBuffer];
|
[m_context flushBuffer];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create rendering window.
|
// Create rendering window.
|
||||||
|
@ -64,9 +64,9 @@ bool cInterfaceAGL::Create(void* window_handle, bool core)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cocoaCtx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
|
m_context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
|
||||||
[fmt release];
|
[fmt release];
|
||||||
if (cocoaCtx == nil)
|
if (m_context == nil)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "failed to create context");
|
ERROR_LOG(VIDEO, "failed to create context");
|
||||||
return false;
|
return false;
|
||||||
|
@ -75,13 +75,13 @@ bool cInterfaceAGL::Create(void* window_handle, bool core)
|
||||||
if (!window_handle)
|
if (!window_handle)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
cocoaWin = static_cast<NSView*>(window_handle);
|
m_view = static_cast<NSView*>(window_handle);
|
||||||
return AttachContextToView(cocoaCtx, cocoaWin, &s_backbuffer_width, &s_backbuffer_height);
|
return AttachContextToView(m_context, m_view, &s_backbuffer_width, &s_backbuffer_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cInterfaceAGL::MakeCurrent()
|
bool cInterfaceAGL::MakeCurrent()
|
||||||
{
|
{
|
||||||
[cocoaCtx makeCurrentContext];
|
[m_context makeCurrentContext];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,21 +94,21 @@ bool cInterfaceAGL::ClearCurrent()
|
||||||
// Close backend
|
// Close backend
|
||||||
void cInterfaceAGL::Shutdown()
|
void cInterfaceAGL::Shutdown()
|
||||||
{
|
{
|
||||||
[cocoaCtx clearDrawable];
|
[m_context clearDrawable];
|
||||||
[cocoaCtx release];
|
[m_context release];
|
||||||
cocoaCtx = nil;
|
m_context = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cInterfaceAGL::Update()
|
void cInterfaceAGL::Update()
|
||||||
{
|
{
|
||||||
if (!cocoaWin)
|
if (!m_view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (UpdateCachedDimensions(cocoaWin, &s_backbuffer_width, &s_backbuffer_height))
|
if (UpdateCachedDimensions(m_view, &s_backbuffer_width, &s_backbuffer_height))
|
||||||
[cocoaCtx update];
|
[m_context update];
|
||||||
}
|
}
|
||||||
|
|
||||||
void cInterfaceAGL::SwapInterval(int interval)
|
void cInterfaceAGL::SwapInterval(int interval)
|
||||||
{
|
{
|
||||||
[cocoaCtx setValues:(GLint*)&interval forParameter:NSOpenGLCPSwapInterval];
|
[m_context setValues:static_cast<GLint*>(&interval) forParameter:NSOpenGLCPSwapInterval];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue