Class GLCanvas

All Implemented Interfaces:
Drawable

public class GLCanvas extends Canvas
GLCanvas is a widget capable of displaying OpenGL content.
Since:
3.2
See Also:
  • Constructor Details

    • 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 Details

    • 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