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.gdk/Ocgtk_gdk/Gdk/Wrappers/Gl_context/index.html

Module Wrappers.Gl_context

type t = [ `gl_context | `draw_context | `object_ ] Gobject.obj
val set_use_es : t -> int -> unit

Requests that GDK create an OpenGL ES context instead of an OpenGL one.

Not all platforms support OpenGL ES.

The @context must not have been realized.

By default, GDK will attempt to automatically detect whether the underlying GL implementation is OpenGL or OpenGL ES once the @context is realized.

You should check the return value of method@Gdk.GLContext.get_use_es after calling method@Gdk.GLContext.realize to decide whether to use the OpenGL or OpenGL ES API, extensions, or shaders.

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

Sets the major and minor version of OpenGL to request.

Setting @major and @minor to zero will use the default values.

Setting @major and @minor lower than the minimum versions required by GTK will result in the context choosing the minimum version.

The @context must not be realized or made current prior to calling this function.

val set_forward_compatible : t -> bool -> unit

Sets whether the `GdkGLContext` should be forward-compatible.

Forward-compatible contexts must not support OpenGL functionality that has been marked as deprecated in the requested version; non-forward compatible contexts, on the other hand, must support both deprecated and non deprecated functionality.

The `GdkGLContext` must not be realized or made current prior to calling this function.

val set_debug_enabled : t -> bool -> unit

Sets whether the `GdkGLContext` should perform extra validations and runtime checking.

This is useful during development, but has additional overhead.

The `GdkGLContext` must not be realized or made current prior to calling this function.

val set_allowed_apis : t -> Gdk_enums.glapi -> unit

Sets the allowed APIs. When gdk_gl_context_realize() is called, only the allowed APIs will be tried. If you set this to 0, realizing will always fail.

If you set it on a realized context, the property will not have any effect. It is only relevant during gdk_gl_context_realize().

By default, all APIs are allowed.

val realize : t -> (bool, GError.t) result

Realizes the given `GdkGLContext`.

It is safe to call this function on a realized `GdkGLContext`.

val make_current : t -> unit

Makes the @context the current one.

val is_shared : t -> t -> bool

Checks if the two GL contexts can share resources.

When they can, the texture IDs from @other can be used in @self. This is particularly useful when passing `GdkGLTexture` objects between different contexts.

Contexts created for the same display with the same properties will always be compatible, even if they are created for different surfaces. For other contexts it depends on the GL backend.

Both contexts must be realized for this check to succeed. If either one is not, this function will return %FALSE.

val is_legacy : t -> bool

Whether the `GdkGLContext` is in legacy mode or not.

The `GdkGLContext` must be realized before calling this function.

When realizing a GL context, GDK will try to use the OpenGL 3.2 core profile; this profile removes all the OpenGL API that was deprecated prior to the 3.2 version of the specification. If the realization is successful, this function will return %FALSE.

If the underlying OpenGL implementation does not support core profiles, GDK will fall back to a pre-3.2 compatibility profile, and this function will return %TRUE.

You can use the value returned by this function to decide which kind of OpenGL API to use, or whether to do extension discovery, or what kind of shader programs to load.

val get_version : t -> int * int

Retrieves the OpenGL version of the @context.

The @context must be realized prior to calling this function.

val get_use_es : t -> bool

Checks whether the @context is using an OpenGL or OpenGL ES profile.

val get_surface : t -> [ `surface | `object_ ] Gobject.obj option

Retrieves the surface used by the @context.

val get_shared_context : t -> t option

Used to retrieves the `GdkGLContext` that this @context share data with.

As many contexts can share data now and no single shared context exists anymore, this function has been deprecated and now always returns %NULL.

val get_required_version : t -> int option * int option

Retrieves required OpenGL version set as a requirement for the @context realization. It will not change even if a greater OpenGL version is supported and used after the @context is realized. See method@Gdk.GLContext.get_version for the real version in use.

See method@Gdk.GLContext.set_required_version.

val get_forward_compatible : t -> bool

Retrieves whether the context is forward-compatible.

See method@Gdk.GLContext.set_forward_compatible.

val get_display : t -> [ `display | `object_ ] Gobject.obj option

Retrieves the display the @context is created for

val get_debug_enabled : t -> bool

Retrieves whether the context is doing extra validations and runtime checking.

See method@Gdk.GLContext.set_debug_enabled.

val get_api : t -> Gdk_enums.glapi

Gets the API currently in use.

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

val get_allowed_apis : t -> Gdk_enums.glapi

Gets the allowed APIs set via gdk_gl_context_set_allowed_apis().