Class GLArea.Builder<B extends GLArea.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
,Accessible.Builder<B>
- Enclosing class:
GLArea
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theGLArea
object.Emitted when the widget is being realized.onRender
(GLArea.RenderCallback handler) Emitted every time the contents of theGtkGLArea
should be redrawn.onResize
(GLArea.ResizeCallback handler) Emitted once when the widget is realized, and then each time the widget is changed while realized.setAllowedApis
(Set<GLAPI> allowedApis) The allowed APIs.setAllowedApis
(GLAPI... allowedApis) The allowed APIs.setAutoRender
(boolean autoRender) If set totrue
the ::render signal will be emitted every time the widget draws.setHasDepthBuffer
(boolean hasDepthBuffer) If set totrue
the widget will allocate and enable a depth buffer for the target framebuffer.setHasStencilBuffer
(boolean hasStencilBuffer) If set totrue
the widget will allocate and enable a stencil buffer for the target framebuffer.setUseEs
(boolean useEs) Deprecated.Methods inherited from class org.gnome.gtk.Widget.Builder
onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, setCanFocus, setCanTarget, setCssClasses, setCssName, setCursor, setFocusable, setFocusOnClick, setHalign, setHasTooltip, setHeightRequest, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequest
Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRole
Methods inherited from interface io.github.jwharm.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theGLArea
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toGLArea
.- Overrides:
build
in classWidget.Builder<B extends GLArea.Builder<B>>
- Returns:
- a new instance of
GLArea
with the properties that were set in the Builder object.
-
setAllowedApis
-
setAutoRender
If set totrue
the ::render signal will be emitted every time the widget draws.This is the default and is useful if drawing the widget is faster.
If set to
false
the data from previous rendering is kept around and will be used for drawing the widget the next time, unless the window is resized. In order to force a renderingGLArea.queueRender()
must be called. This mode is useful when the scene changes seldom, but takes a long time to redraw.- Parameters:
autoRender
- the value for theauto-render
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHasDepthBuffer
If set totrue
the widget will allocate and enable a depth buffer for the target framebuffer.Setting this property will enable GL's depth testing as a side effect. If you don't need depth testing, you should call
glDisable(GL_DEPTH_TEST)
in yourGtkGLArea::render
handler.- Parameters:
hasDepthBuffer
- the value for thehas-depth-buffer
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHasStencilBuffer
If set totrue
the widget will allocate and enable a stencil buffer for the target framebuffer.- Parameters:
hasStencilBuffer
- the value for thehas-stencil-buffer
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setUseEs
Deprecated.If set totrue
the widget will try to create aGdkGLContext
using OpenGL ES instead of OpenGL.- Parameters:
useEs
- the value for theuse-es
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setAllowedApis
-
onCreateContext
Emitted when the widget is being realized.This allows you to override how the GL context is created. This is useful when you want to reuse an existing GL context, or if you want to try creating different kinds of GL options.
If context creation fails then the signal handler can use
GLArea.setError(org.gnome.glib.GError)
to register a more detailed error of how the construction failed.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRender
Emitted every time the contents of theGtkGLArea
should be redrawn.The
context
is bound to thearea
prior to emitting this function, and the buffers are painted to the window once the emission terminates.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onResize
Emitted once when the widget is realized, and then each time the widget is changed while realized.This is useful in order to keep GL state up to date with the widget size, like for instance camera properties which may depend on the width/height ratio.
The GL context for the area is guaranteed to be current when this signal is emitted.
The default handler sets up the GL viewport.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-