package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Gl_area/index.html

Module Wrappers.Gl_area

type t = [ `gl_area | `widget | `initially_unowned | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new GLArea

val set_use_es : t -> bool -> unit

Sets whether the @area should create an OpenGL or an OpenGL ES context.

You should check the capabilities of the `GdkGLContext` before drawing with either API.

val set_required_version : t -> int -> int -> unit

Sets the required version of OpenGL to be used when creating the context for the widget.

This function must be called before the area has been realized.

val set_has_stencil_buffer : t -> bool -> unit

Sets whether the `GtkGLArea` should use a stencil buffer.

If @has_stencil_buffer is %TRUE the widget will allocate and enable a stencil buffer for the target framebuffer. Otherwise there will be none.

val set_has_depth_buffer : t -> bool -> unit

Sets whether the `GtkGLArea` should use a depth buffer.

If @has_depth_buffer is %TRUE the widget will allocate and enable a depth buffer for the target framebuffer. Otherwise there will be none.

val set_error : t -> GError.t option -> unit

Sets an error on the area which will be shown instead of the GL rendering.

This is useful in the signal@Gtk.GLArea::create-context signal if GL context creation fails.

val set_auto_render : t -> bool -> unit

Sets whether the `GtkGLArea` is in auto render mode.

If @auto_render is %TRUE the signal@Gtk.GLArea::render signal will be emitted every time the widget draws. This is the default and is useful if drawing the widget is faster.

If @auto_render is %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 rendering method@Gtk.GLArea.queue_render must be called. This mode is useful when the scene changes seldom, but takes a long time to redraw.

val set_allowed_apis : t -> Ocgtk_gdk.Gdk.glapi -> unit

Sets the allowed APIs to create a context with.

You should check property@Gtk.GLArea:api before drawing with either API.

By default, all APIs are allowed.

val queue_render : t -> unit

Marks the currently rendered data (if any) as invalid, and queues a redraw of the widget.

This ensures that the signal@Gtk.GLArea::render signal is emitted during the draw.

This is only needed when method@Gtk.GLArea.set_auto_render has been called with a %FALSE value. The default behaviour is to emit signal@Gtk.GLArea::render on each draw.

val make_current : t -> unit

Ensures that the `GdkGLContext` used by @area is associated with the `GtkGLArea`.

This function is automatically called before emitting the signal@Gtk.GLArea::render signal, and doesn't normally need to be called by application code.

val get_use_es : t -> bool

Returns whether the `GtkGLArea` should use OpenGL ES.

See method@Gtk.GLArea.set_use_es.

val get_required_version : t -> int * int

Retrieves the required version of OpenGL.

See method@Gtk.GLArea.set_required_version.

val get_has_stencil_buffer : t -> bool

Returns whether the area has a stencil buffer.

val get_has_depth_buffer : t -> bool

Returns whether the area has a depth buffer.

val get_error : t -> GError.t option

Gets the current error set on the @area.

val get_context : t -> Ocgtk_gdk.Gdk.Wrappers.Gl_context.t option

Retrieves the `GdkGLContext` used by @area.

val get_auto_render : t -> bool

Returns whether the area is in auto render mode or not.

val get_api : t -> Ocgtk_gdk.Gdk.glapi

Gets the API that is currently in use.

If the GL area has not been realized yet, 0 is returned.

val get_allowed_apis : t -> Ocgtk_gdk.Gdk.glapi

Gets the allowed APIs.

See method@Gtk.GLArea.set_allowed_apis.

val attach_buffers : t -> unit

Binds buffers to the framebuffer.

Ensures that the @area framebuffer object is made the current draw and read target, and that all the required buffers for the @area are created and bound to the framebuffer.

This function is automatically called before emitting the signal@Gtk.GLArea::render signal, and doesn't normally need to be called by application code.

val on_create_context : ?after:bool -> t -> callback:(unit -> Ocgtk_gdk.Gdk.Wrappers.Gl_context.t) -> Gobject.Signal.handler_id
val on_render : ?after:bool -> t -> callback:(context:Ocgtk_gdk.Gdk.Wrappers.Gl_context.t -> bool) -> Gobject.Signal.handler_id
val on_resize : ?after:bool -> t -> callback:(width:int -> height:int -> unit) -> Gobject.Signal.handler_id