Added EGL resize.
This commit is contained in:
parent
b77df356c1
commit
de8465ce6d
@ -45,6 +45,14 @@ namespace bgfx
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
EGLint numConfig = 0;
|
||||
EGLConfig config;
|
||||
success = eglChooseConfig(m_display, attrs, &config, 1, &numConfig);
|
||||
BGFX_FATAL(success, Fatal::UnableToInitialize, "eglChooseConfig");
|
||||
|
||||
m_surface = eglCreateWindowSurface(m_display, config, nwt, NULL);
|
||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
|
||||
|
||||
EGLint contextAttrs[] =
|
||||
{
|
||||
# if BGFX_CONFIG_RENDERER_OPENGLES2
|
||||
@ -56,14 +64,6 @@ namespace bgfx
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
EGLint numConfig = 0;
|
||||
EGLConfig config = 0;
|
||||
success = eglChooseConfig(m_display, attrs, &config, 1, &numConfig);
|
||||
BGFX_FATAL(success, Fatal::UnableToInitialize, "eglChooseConfig");
|
||||
|
||||
m_surface = eglCreateWindowSurface(m_display, config, nwt, NULL);
|
||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
|
||||
|
||||
m_context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttrs);
|
||||
BGFX_FATAL(m_context != EGL_NO_CONTEXT, Fatal::UnableToInitialize, "Failed to create context.");
|
||||
|
||||
@ -88,6 +88,37 @@ namespace bgfx
|
||||
|
||||
void GlContext::resize(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
eglDestroySurface(m_display, m_surface);
|
||||
|
||||
EGLint attrs[] =
|
||||
{
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
|
||||
# if BX_PLATFORM_ANDROID
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
# else
|
||||
EGL_DEPTH_SIZE, 24,
|
||||
# endif // BX_PLATFORM_
|
||||
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
EGLint numConfig = 0;
|
||||
EGLConfig config;
|
||||
EGLBoolean success = eglChooseConfig(m_display, attrs, &config, 1, &numConfig);
|
||||
BGFX_FATAL(success, Fatal::UnableToInitialize, "eglChooseConfig");
|
||||
|
||||
EGLNativeWindowType nwt = (EGLNativeWindowType)NULL;
|
||||
# if BX_PLATFORM_WINDOWS
|
||||
nwt = g_bgfxHwnd;
|
||||
# endif // BX_PLATFORM_
|
||||
|
||||
m_surface = eglCreateWindowSurface(m_display, config, nwt, NULL);
|
||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
|
||||
|
||||
eglMakeCurrent(m_display, m_surface, m_surface, m_context);
|
||||
}
|
||||
|
||||
void GlContext::swap()
|
||||
|
Loading…
Reference in New Issue
Block a user