Trait gdk4::prelude::GLContextExt [−][src]
pub trait GLContextExt: 'static {
Show 14 methods
fn is_debug_enabled(&self) -> bool;
fn is_forward_compatible(&self) -> bool;
fn required_version(&self) -> (i32, i32);
fn shared_context(&self) -> Option<GLContext>;
fn uses_es(&self) -> bool;
fn version(&self) -> (i32, i32);
fn is_legacy(&self) -> bool;
fn is_shared<P: IsA<GLContext>>(&self, other: &P) -> bool;
fn make_current(&self);
fn realize(&self) -> Result<(), Error>;
fn set_debug_enabled(&self, enabled: bool);
fn set_forward_compatible(&self, compatible: bool);
fn set_required_version(&self, major: i32, minor: i32);
fn set_use_es(&self, use_es: i32);
}
Expand description
Required methods
fn is_debug_enabled(&self) -> bool
fn is_debug_enabled(&self) -> bool
Retrieves whether the context is doing extra validations and runtime checking.
See set_debug_enabled()
.
Returns
true
if debugging is enabled
fn is_forward_compatible(&self) -> bool
fn is_forward_compatible(&self) -> bool
Used to retrieves the GLContext
that this self
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 None
.
Deprecated since 4.4
Use is_shared()
to check if contexts
can be shared.
Returns
Whether the GLContext
is in legacy mode or not.
The GLContext
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.
Returns
true
if the GL context is in legacy mode
v4_4
only.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 GLTexture
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
.
other
the GLContext
that should be compatible with self
Returns
true
if the two GL contexts are compatible.
fn make_current(&self)
fn make_current(&self)
Makes the self
the current one.
fn set_debug_enabled(&self, enabled: bool)
fn set_debug_enabled(&self, enabled: bool)
fn set_forward_compatible(&self, compatible: bool)
fn set_forward_compatible(&self, compatible: bool)
Sets whether the GLContext
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 GLContext
must not be realized or made current prior to calling
this function.
compatible
whether the context should be forward-compatible
fn set_required_version(&self, major: i32, minor: i32)
fn set_required_version(&self, major: i32, minor: i32)
fn set_use_es(&self, use_es: i32)
fn set_use_es(&self, use_es: i32)
Requests that GDK create an OpenGL ES context instead of an OpenGL one.
Not all platforms support OpenGL ES.
The self
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 self
is realized.
You should check the return value of uses_es()
after calling realize()
to decide whether to use
the OpenGL or OpenGL ES API, extensions, or shaders.
use_es
whether the context should use OpenGL ES instead of OpenGL, or -1 to allow auto-detection