Top Description Fields Constructors Methods
org.eclipse.swt.opengl

public Class GLCanvas

extends Canvas
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*, org.eclipse.swt.internal.gtk3.*, org.eclipse.swt.internal.opengl.glx.*, org.eclipse.swt.widgets.*

GLCanvas is a widget capable of displaying OpenGL content.
Since
3.2
See Also
GLData, OpenGL snippets, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv long
pack-priv long
pack-priv static final int
pack-priv XVisualInfo
pack-priv long

Constructor Summary

AccessConstructor and Description
public
GLCanvas(Composite
a composite widget
parent
,
int
the bitwise OR'ing of widget styles
style
,
GLData
the requested attributes of the GLCanvas
data
)

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

Method Summary

Modifier and TypeMethod and Description
private long
public GLData

Returns:

GLData description of the OpenGL context attributes
getGLData
()

Returns a GLData object describing the created context.

public boolean

Returns:

true if the receiver holds the current OpenGL context, false otherwise
isCurrent
()

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

public void
setCurrent()

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

public void
swapBuffers()

Swaps the front and back color buffers.

Inherited from org.eclipse.swt.widgets.Canvas:
drawBackgroundgetCaretgetIMEscrollsetCaretsetFontsetIME

Field Detail

contextback to summary
pack-priv long context
glWindowback to summary
pack-priv long glWindow
MAX_ATTRIBUTESback to summary
pack-priv static final int MAX_ATTRIBUTES
vinfoback to summary
pack-priv XVisualInfo vinfo
xWindowback to summary
pack-priv long xWindow

Constructor Detail

GLCanvasback to summary
public GLCanvas(Composite parent, int style, GLData data)

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

Parameters
parent:Composite

a composite widget

style:int

the bitwise OR'ing of widget styles

data:GLData

the requested attributes of the GLCanvas

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT when the data is null
  • ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided

Method Detail

gdk_x11_display_get_xdisplayback to summary
private long gdk_x11_display_get_xdisplay(long window)
getGLDataback to summary
public GLData getGLData()

Returns a GLData object describing the created context.

Returns:GLData

GLData description of the OpenGL context attributes

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
isCurrentback to summary
public boolean isCurrent()

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

Returns:boolean

true if the receiver holds the current OpenGL context, false otherwise

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setCurrentback to summary
public void setCurrent()

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

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
swapBuffersback to summary
public void swapBuffers()

Swaps the front and back color buffers.

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