]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/glx/glcontext.cpp
Use nullptr in place of 0 or NULL
[libs/gui.git] / source / graphics / glx / glcontext.cpp
index 699f856f35d06ce239f7576e7b499500f3b6fc6a..ad63350283c223cc3a92aec699f316e5b8ad471c 100644 (file)
@@ -17,7 +17,7 @@ typedef GLXContext ContextHandle;
 
 struct GLContext::Private
 {
-       ContextHandle context = 0;
+       ContextHandle context = nullptr;
        // We need to create a window with the chosen visual
        WindowHandle subwnd = None;
        GLXWindow glxwnd = None;
@@ -97,7 +97,7 @@ void GLContext::platform_init(const GLOptions &opts)
                priv->subwnd = XCreateWindow(dpy, window.get_private().window, 0, 0, window.get_width(), window.get_height(), 0, vi->depth, InputOutput, vi->visual, CWColormap, &attr);
                XMapWindow(dpy, priv->subwnd);
 
-               priv->glxwnd = glXCreateWindow(dpy, fb_configs[0], priv->subwnd, 0);
+               priv->glxwnd = glXCreateWindow(dpy, fb_configs[0], priv->subwnd, nullptr);
 
                if(opts.forward_compatible || opts.gl_version_major!=GLOptions::DEFAULT_VERSION)
                {
@@ -108,7 +108,7 @@ void GLContext::platform_init(const GLOptions &opts)
                        unsigned gl_version_minor = opts.gl_version_minor;
                        if(opts.gl_version_major==GLOptions::LATEST_VERSION)
                        {
-                               ContextHandle probe_context = glXCreateNewContext(dpy, fb_configs[0], GLX_RGBA_TYPE, 0, true);
+                               ContextHandle probe_context = glXCreateNewContext(dpy, fb_configs[0], GLX_RGBA_TYPE, nullptr, true);
                                glXMakeContextCurrent(dpy, priv->glxwnd, priv->glxwnd, probe_context);
 
                                const char *gl_ver_ptr = reinterpret_cast<const char *>(glGetString(GL_VERSION));
@@ -121,7 +121,7 @@ void GLContext::platform_init(const GLOptions &opts)
                                gl_version_major = lexical_cast<unsigned>(parts[0]);
                                gl_version_minor = lexical_cast<unsigned>(parts[1]);
 
-                               glXMakeContextCurrent(dpy, 0, 0, 0);
+                               glXMakeContextCurrent(dpy, None, None, nullptr);
                                glXDestroyContext(dpy, probe_context);
                        }
 
@@ -154,10 +154,10 @@ void GLContext::platform_init(const GLOptions &opts)
 
                        const GLubyte *name = reinterpret_cast<const GLubyte *>("glXCreateContextAttribsARB");
                        PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = reinterpret_cast<PFNGLXCREATECONTEXTATTRIBSARBPROC>(glXGetProcAddressARB(name));
-                       priv->context = glXCreateContextAttribs(dpy, fb_configs[0], 0, true, &ctx_attribs[0]);
+                       priv->context = glXCreateContextAttribs(dpy, fb_configs[0], nullptr, true, &ctx_attribs[0]);
                }
                else
-                       priv->context = glXCreateNewContext(dpy, fb_configs[0], GLX_RGBA_TYPE, 0, true);
+                       priv->context = glXCreateNewContext(dpy, fb_configs[0], GLX_RGBA_TYPE, nullptr, true);
 
                XFree(vi);
                XFree(fb_configs);
@@ -205,7 +205,7 @@ void GLContext::platform_init(const GLOptions &opts)
 
                priv = new Private;
                priv->glxwnd = 0;
-               priv->context = glXCreateContext(dpy, vi, 0, true);
+               priv->context = glXCreateContext(dpy, vi, nullptr, true);
 
                XSetWindowAttributes attr;
                attr.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), vi->visual, AllocNone);
@@ -225,11 +225,11 @@ GLContext::~GLContext()
 
        if(priv->glxwnd)
        {
-               glXMakeContextCurrent(dpy, 0, 0, 0);
+               glXMakeContextCurrent(dpy, None, None, nullptr);
                glXDestroyWindow(dpy, priv->glxwnd);
        }
        else
-               glXMakeCurrent(dpy, 0, 0);
+               glXMakeCurrent(dpy, None, nullptr);
        glXDestroyContext(dpy, priv->context);
        XDestroyWindow(dpy, priv->subwnd);