]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/egl_android/glcontext.cpp
Use nullptr in place of 0 or NULL
[libs/gui.git] / source / graphics / egl_android / glcontext.cpp
index ecf9a63f29342515c6ec1be24a03e6f5bd995dd7..809ed0499591587c299e8c8cae018d4608e1dc20 100644 (file)
@@ -1,9 +1,9 @@
+#include "glcontext.h"
 #include <vector>
 #include <EGL/egl.h>
 #include <GLES2/gl2.h>
 #include <android/native_window.h>
 #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<int> 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,16 +109,19 @@ GLContext::~GLContext()
        delete priv;
 }
 
-void GLContext::swap_buffers()
+void GLContext::set_swap_interval(unsigned)
 {
-       eglSwapBuffers(priv->display, priv->surface);
+       // TODO
 }
 
-void GLContext::window_resized(unsigned w, unsigned h)
+void GLContext::swap_buffers()
 {
-       glViewport(0, 0, w, h);
+       eglSwapBuffers(priv->display, priv->surface);
 }
 
+void GLContext::window_resized(unsigned, unsigned)
+{ }
+
 
 void GLContext::Private::attach(WindowHandle native_window)
 {