fixes in EGL platform
This commit is contained in:
parent
3a6f326a8a
commit
d49cad31e2
|
@ -19,7 +19,7 @@ ConsoleTabBarPanel < TabBarPanel
|
||||||
type: verticalBox
|
type: verticalBox
|
||||||
align-bottom: true
|
align-bottom: true
|
||||||
border-width: 1
|
border-width: 1
|
||||||
border-color: #101317
|
border-color: #202327
|
||||||
background: #00000044
|
background: #00000044
|
||||||
inverted-scroll: true
|
inverted-scroll: true
|
||||||
padding: 1
|
padding: 1
|
||||||
|
|
|
@ -77,6 +77,7 @@ void FrameBuffer::resize(const Size& size)
|
||||||
internalRelease();
|
internalRelease();
|
||||||
} else {
|
} else {
|
||||||
m_screenBackup = TexturePtr(new Texture(size.width(), size.height()));
|
m_screenBackup = TexturePtr(new Texture(size.width(), size.height()));
|
||||||
|
m_screenBackup->setUpsideDown(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
typedef char GLchar;
|
typedef char GLchar;
|
||||||
|
|
||||||
// define OpenGL ES 2.0 API just to make compile, it wont actually be used
|
// define OpenGL ES 2.0 API just to make compile, it wont actually be used
|
||||||
|
inline void glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { }
|
||||||
inline void glBindFramebuffer (GLenum target, GLuint framebuffer) { }
|
inline void glBindFramebuffer (GLenum target, GLuint framebuffer) { }
|
||||||
inline void glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers) { }
|
inline void glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers) { }
|
||||||
inline void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { }
|
inline void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { }
|
||||||
|
|
|
@ -359,8 +359,10 @@ bool Graphics::canUseClampToEdge()
|
||||||
|
|
||||||
bool Graphics::canUseBlendFuncSeparate()
|
bool Graphics::canUseBlendFuncSeparate()
|
||||||
{
|
{
|
||||||
#ifdef OPENGL_ES
|
#if OPENGL_ES==2
|
||||||
return true;
|
return true;
|
||||||
|
#elif OPENGL_ES==1
|
||||||
|
return false;
|
||||||
#else
|
#else
|
||||||
if(!GLEW_VERSION_1_4)
|
if(!GLEW_VERSION_1_4)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -261,7 +261,7 @@ void X11Window::internalCreateWindow()
|
||||||
{
|
{
|
||||||
Visual *vis;
|
Visual *vis;
|
||||||
int depth;
|
int depth;
|
||||||
unsigned int attrsMask = CWEventMask;
|
unsigned int attrsMask;
|
||||||
XSetWindowAttributes attrs;
|
XSetWindowAttributes attrs;
|
||||||
memset(&attrs, 0, sizeof(attrs));
|
memset(&attrs, 0, sizeof(attrs));
|
||||||
|
|
||||||
|
@ -270,19 +270,18 @@ void X11Window::internalCreateWindow()
|
||||||
ExposureMask | VisibilityChangeMask |
|
ExposureMask | VisibilityChangeMask |
|
||||||
StructureNotifyMask | FocusChangeMask;
|
StructureNotifyMask | FocusChangeMask;
|
||||||
|
|
||||||
if(m_visual) {
|
m_colormap = XCreateColormap(m_display, m_rootWindow, m_visual->visual, AllocNone);
|
||||||
m_colormap = XCreateColormap(m_display, m_rootWindow, m_visual->visual, AllocNone);
|
attrs.colormap = m_colormap;
|
||||||
attrs.colormap = m_colormap;
|
attrs.border_pixel = 0;
|
||||||
attrs.border_pixel = 0;
|
attrs.override_redirect = False;
|
||||||
attrsMask |= CWBorderPixel | CWColormap;
|
vis = m_visual->visual;
|
||||||
vis = m_visual->visual;
|
depth = m_visual->depth;
|
||||||
depth = m_visual->depth;
|
attrsMask = CWEventMask | CWBorderPixel | CWColormap;
|
||||||
} else {
|
|
||||||
attrs.override_redirect = False;
|
#ifdef OPENGL_ES
|
||||||
attrsMask |= CWOverrideRedirect;
|
attrs.override_redirect = False;
|
||||||
depth = CopyFromParent;
|
attrsMask |= CWOverrideRedirect;
|
||||||
vis = CopyFromParent;
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
updateUnmaximizedCoords();
|
updateUnmaximizedCoords();
|
||||||
m_window = XCreateWindow(m_display, m_rootWindow,
|
m_window = XCreateWindow(m_display, m_rootWindow,
|
||||||
|
@ -371,17 +370,33 @@ void X11Window::internalChooseGLVisual()
|
||||||
#else
|
#else
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
|
||||||
#endif
|
#endif
|
||||||
EGL_ALPHA_SIZE, 1,
|
EGL_RED_SIZE, 4,
|
||||||
|
EGL_GREEN_SIZE, 4,
|
||||||
|
EGL_BLUE_SIZE, 4,
|
||||||
|
EGL_ALPHA_SIZE, 4,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
EGLint numConfig;
|
EGLint numConfig;
|
||||||
|
XVisualInfo visTemplate;
|
||||||
|
int numVisuals;
|
||||||
|
|
||||||
if(!eglChooseConfig(m_eglDisplay, attrList, &m_eglConfig, 1, &numConfig))
|
if(!eglChooseConfig(m_eglDisplay, attrList, &m_eglConfig, 1, &numConfig))
|
||||||
g_logger.fatal("Failed to choose EGL config");
|
g_logger.fatal("Failed to choose EGL config");
|
||||||
|
|
||||||
if(numConfig != 1)
|
if(numConfig != 1)
|
||||||
g_logger.warning("Didn't got the exact EGL config");
|
g_logger.warning("Didn't got the exact EGL config");
|
||||||
|
|
||||||
|
EGLint vid;
|
||||||
|
if(!eglGetConfigAttrib(m_eglDisplay, m_eglConfig, EGL_NATIVE_VISUAL_ID, &vid))
|
||||||
|
g_logger.fatal("Unable to get visual EGL visual id");
|
||||||
|
|
||||||
|
memset(&visTemplate, 0, sizeof(visTemplate));
|
||||||
|
visTemplate.visualid = vid;
|
||||||
|
m_visual = XGetVisualInfo(m_display, VisualIDMask, &visTemplate, &numVisuals);
|
||||||
|
if(!m_visual)
|
||||||
|
g_logger.fatal("Couldn't choose RGBA, double buffered visual");
|
||||||
|
|
||||||
m_rootWindow = DefaultRootWindow(m_display);
|
m_rootWindow = DefaultRootWindow(m_display);
|
||||||
#else
|
#else
|
||||||
static int attrList[] = {
|
static int attrList[] = {
|
||||||
|
@ -421,7 +436,7 @@ void X11Window::internalCreateGLContext()
|
||||||
|
|
||||||
m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attrList);
|
m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attrList);
|
||||||
if(m_eglContext == EGL_NO_CONTEXT )
|
if(m_eglContext == EGL_NO_CONTEXT )
|
||||||
g_logger.fatal("Unable to create EGL context: %s", eglGetError());
|
g_logger.fatal(stdext::format("Unable to create EGL context: %s", eglGetError()));
|
||||||
#else
|
#else
|
||||||
m_glxContext = glXCreateContext(m_display, m_visual, NULL, True);
|
m_glxContext = glXCreateContext(m_display, m_visual, NULL, True);
|
||||||
|
|
||||||
|
@ -462,7 +477,7 @@ void X11Window::internalConnectGLContext()
|
||||||
#ifdef OPENGL_ES
|
#ifdef OPENGL_ES
|
||||||
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig, m_window, NULL);
|
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig, m_window, NULL);
|
||||||
if(m_eglSurface == EGL_NO_SURFACE)
|
if(m_eglSurface == EGL_NO_SURFACE)
|
||||||
g_logger.fatal("Unable to create EGL surface: %s", eglGetError());
|
g_logger.fatal(stdext::format("Unable to create EGL surface: %s", eglGetError()));
|
||||||
if(!eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext))
|
if(!eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext))
|
||||||
g_logger.fatal("Unable to connect EGL context into X11 window");
|
g_logger.fatal("Unable to connect EGL context into X11 window");
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue