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 Link icon

    • GLCanvas Link icon

      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 Link icon

    • getGLData Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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