/** * Sets the OpenGL context associated with this GLCanvas to be the current GL context. * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void setCurrent() { checkWidget(); if (GLX.glXGetCurrentContext() == context) return; int /*long*/ window = OS.GTK_WIDGET_WINDOW(handle); int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay(window); GLX.glXMakeCurrent(xDisplay, xWindow, context); }
/** * Returns a boolean indicating whether the receiver's OpenGL context is the current context. * * @return true if the receiver holds the current OpenGL context, false otherwise * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public boolean isCurrent() { checkWidget(); return GLX.glXGetCurrentContext() == context; }