diff --git a/pyopencl/tools.py b/pyopencl/tools.py
index 7304cfc73dbcf722223e5bb2da1510dd909de6dc..a3c577ef88854042b249c6d83651147af9ae298f 100644
--- a/pyopencl/tools.py
+++ b/pyopencl/tools.py
@@ -413,7 +413,7 @@ def get_gl_sharing_context_properties():
     if sys.platform in ["linux", "linux2"]:
         from OpenGL import GLX
         props.append(
-            (ctx_props.GL_CONTEXT_KHR, gl_platform.GetCurrentContext()))
+            (ctx_props.GL_CONTEXT_KHR, GLX.glXGetCurrentContext()))
         props.append(
                 (ctx_props.GLX_DISPLAY_KHR,
                     GLX.glXGetCurrentDisplay()))