X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fegl_android%2Fglcontext.cpp;h=809ed0499591587c299e8c8cae018d4608e1dc20;hb=1ea8498c4c729f849095e2f4aa3d282de2000a35;hp=0e9873980606316bc6cf381383479e165741bf8e;hpb=2deed84c84e513ee1c2a2fbbcd3946c1d772fcbb;p=libs%2Fgui.git diff --git a/source/graphics/egl_android/glcontext.cpp b/source/graphics/egl_android/glcontext.cpp index 0e98739..809ed04 100644 --- a/source/graphics/egl_android/glcontext.cpp +++ b/source/graphics/egl_android/glcontext.cpp @@ -1,9 +1,9 @@ +#include "glcontext.h" #include #include #include #include #include "display.h" -#include "glcontext.h" #include "window_private.h" using namespace std; @@ -13,10 +13,10 @@ namespace Graphics { struct GLContext::Private { - EGLDisplay display; - EGLConfig config; - EGLSurface surface; - EGLContext context; + EGLDisplay display = EGL_NO_DISPLAY; + EGLConfig config = EGL_NO_CONFIG; + EGLSurface surface = EGL_NO_SURFACE; + EGLContext context = EGL_NO_CONTEXT; void attach(WindowHandle); void detach(); @@ -29,7 +29,7 @@ void GLContext::platform_init(const GLOptions &opts) if(egl_display==EGL_NO_DISPLAY) throw runtime_error("no egl display"); - if(!eglInitialize(egl_display, 0, 0)) + if(!eglInitialize(egl_display, nullptr, nullptr)) throw runtime_error("could not initialize egl"); vector attribs; @@ -88,11 +88,11 @@ void GLContext::platform_init(const GLOptions &opts) eglGetConfigAttrib(priv->display, config, EGL_NATIVE_VISUAL_ID, &format); ANativeWindow_setBuffersGeometry(native_window, 0, 0, format); - priv->surface = eglCreateWindowSurface(priv->display, config, native_window, 0); + priv->surface = eglCreateWindowSurface(priv->display, config, native_window, nullptr); eglBindAPI(EGL_OPENGL_ES_API); int context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; - priv->context = eglCreateContext(priv->display, config, 0, context_attribs); + priv->context = eglCreateContext(priv->display, config, nullptr, context_attribs); eglMakeCurrent(priv->display, priv->surface, priv->surface, priv->context); @@ -109,6 +109,11 @@ GLContext::~GLContext() delete priv; } +void GLContext::set_swap_interval(unsigned) +{ + // TODO +} + void GLContext::swap_buffers() { eglSwapBuffers(priv->display, priv->surface);