Eclipse Platform Release 3.7

## org.eclipse.swt.opengl
Class GLCanvas

    java.lang.Object
      org.eclipse.swt.widgets.Widget
          org.eclipse.swt.widgets.Control
              org.eclipse.swt.widgets.Scrollable
                  org.eclipse.swt.widgets.Composite
                      org.eclipse.swt.widgets.Canvas
                          org.eclipse.swt.opengl.GLCanvas

All Implemented Interfaces:
  Drawable

    public class GLCanvas

extends Canvas

GLCanvas is a widget capable of displaying OpenGL content.

Since:
  3.2
See Also:
  `GLData`, OpenGL snippets, Sample code and further information

Field Summary

Fields inherited from class org.eclipse.swt.widgets.Control
`handle`

Constructor Summary
`GLCanvas(Composite parent, int style, GLData data)` Create a GLCanvas widget using the attributes described in the GLData object provided.

Method Summary
`GLData` `getGLData()` Returns a GLData object describing the created context.
`boolean` `isCurrent()` Returns a boolean indicating whether the receiver's OpenGL context is the current context.
`void` `setCurrent()` Sets the OpenGL context associated with this GLCanvas to be the current GL context.
`void` `swapBuffers()` Swaps the front and back color buffers.

Methods inherited from class org.eclipse.swt.widgets.Canvas
`drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME`

Methods inherited from class org.eclipse.swt.widgets.Composite
`changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList`

Methods inherited from class org.eclipse.swt.widgets.Scrollable
`computeTrim, getClientArea, getHorizontalBar, getVerticalBar`

Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

Methods inherited from class org.eclipse.swt.widgets.Widget
`addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### GLCanvas

    public GLCanvas(Composite parent,
                    int style,
                    GLData data)

  Create a GLCanvas widget using the attributes described in the GLData object provided.

  Parameters:
    `parent` - a composite widget
    `style` - the bitwise OR'ing of widget styles
    `data` - the requested attributes of the GLCanvas
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when the data is null
    - ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided

Method Detail

### getGLData

    public GLData getGLData()

  Returns a GLData object describing the created context.

  Returns:
    GLData description of the OpenGL context attributes
  Throws:
    `SWTException` -
    - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

### isCurrent

    public boolean isCurrent()

  Returns a boolean indicating whether the receiver's OpenGL context is the current context.

  Returns:
    true if the receiver holds the current OpenGL context, false otherwise
  Throws:
    `SWTException` -
    - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

### setCurrent

    public void setCurrent()

  Sets the OpenGL context associated with this GLCanvas to be the current GL context.

  Throws:
    `SWTException` -
    - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

### swapBuffers

    public void swapBuffers()

  Swaps the front and back color buffers.

  Throws:
    `SWTException` -
    - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.