Trait gstreamer_gl::prelude::GLContextExt[][src]

pub trait GLContextExt: 'static {
Show methods fn activate(&self, activate: bool) -> Result<(), BoolError>;
fn can_share<P: IsA<GLContext>>(&self, other_context: &P) -> bool;
fn check_feature(&self, feature: &str) -> bool;
fn check_framebuffer_status(&self, fbo_target: u32) -> bool;
fn check_gl_version(&self, api: GLAPI, maj: i32, min: i32) -> bool;
fn clear_framebuffer(&self);
fn clear_shader(&self);
fn create<P: IsA<GLContext>>(
        &self,
        other_context: Option<&P>
    ) -> Result<(), Error>;
fn destroy(&self);
fn fill_info(&self) -> Result<(), Error>;
fn config(&self) -> Option<Structure>;
fn display(&self) -> GLDisplay;
fn gl_api(&self) -> GLAPI;
fn gl_platform(&self) -> GLPlatform;
fn gl_platform_version(&self) -> (i32, i32);
fn gl_version(&self) -> (i32, i32);
fn window(&self) -> Option<GLWindow>;
fn is_shared(&self) -> bool;
fn request_config(&self, gl_config: Option<&Structure>) -> bool;
fn set_shared_with<P: IsA<GLContext>>(&self, share: &P);
fn set_window<P: IsA<GLWindow>>(&self, window: &P) -> Result<(), BoolError>;
fn supports_glsl_profile_version(
        &self,
        version: GLSLVersion,
        profile: GLSLProfile
    ) -> bool;
fn supports_precision(
        &self,
        version: GLSLVersion,
        profile: GLSLProfile
    ) -> bool;
fn supports_precision_highp(
        &self,
        version: GLSLVersion,
        profile: GLSLProfile
    ) -> bool;
fn swap_buffers(&self);
}
Expand description

Trait containing all GLContext methods.

Implementors

GLContext

Required methods

(De)activate the OpenGL context represented by this self.

In OpenGL terms, calls eglMakeCurrent or similar with this context and the currently set window. See set_window() for details.

activate

true to activate, false to deactivate

Returns

Whether the activation succeeded

Note: This will always fail for two wrapped GLContext’s

other_context

another GLContext

Returns

whether self and other_context are able to share OpenGL resources.

Check for an OpenGL feature being supported.

Note: Most features require that the context be created before it is possible to determine their existence and so will fail if that is not the case.

feature

a platform specific feature

Returns

Whether feature is supported by self

Must be called with self current.

fbo_target

the GL value of the framebuffer target, GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER, GL_DRAW_FRAMEBUFFER

Returns

whether whether the current framebuffer is complete

api

api type required

maj

major version required

min

minor version required

Returns

whether OpenGL context implements the required api and specified version.

Unbind the current framebuffer

Clear’s the currently set shader from the GL state machine.

Note: must be called in the GL thread.

Creates an OpenGL context with the specified other_context as a context to share shareable OpenGL objects with. See the OpenGL specification for what is shared between OpenGL contexts.

Since 1.20, the configuration can be overriden with the environment variable GST_GL_CONFIG which is a stringified gst::Structure as would be returned from config(). If GST_GL_CONFIG is not set, then the config will be chosen from other_context by calling config() on other_context. Otherwise, a default configuration is used.

Calling request_config()) before calling create() will override the config from other_context but will not override the GST_GL_CONFIG environment variable.

If an error occurs, and error is not None, then error will contain details of the error and false will be returned.

Should only be called once.

other_context

a GLContext to share OpenGL objects with

Returns

whether the context could successfully be created

Destroys an OpenGL context.

Should only be called after create() has been successfully called for this context.

Fills self’s info (version, extensions, vtable, etc) from the GL context in the current thread. Typically used with wrapped contexts to allow wrapped contexts to be used as regular GLContext’s.

This is supported on crate feature v1_20 only.

Retrieve the OpenGL configuration for this context. The context must have been successfully created for this function to return a valid value.

Not all implementations currently support retrieving the config and will return None when not supported.

Returns

the configuration chosen for this OpenGL context.

Returns

the GLDisplay associated with this self

Get the currently enabled OpenGL api.

The currently available API may be limited by the GLDisplay in use and/or the GLWindow chosen.

Returns

the available OpenGL api

Gets the OpenGL platform that used by self.

Returns

The platform specific backing OpenGL context

Get the version of the OpenGL platform (GLX, EGL, etc) used. Only valid after a call to create().

Returns

major

return for the major version

minor

return for the minor version

Returns the OpenGL version implemented by self. See gl_api() for retrieving the OpenGL api implemented by self.

Returns

maj

resulting major version

min

resulting minor version

Returns

the currently set window

Returns

Whether the GLContext has been shared with another GLContext

This is supported on crate feature v1_20 only.

Set the OpenGL configuration for this context. The context must not have been created for this function to succeed. Setting a None config has the affect of removing any specific configuration request.

Not all implementations currently support retrieving the config and this function will return FALSE when not supported.

Note that calling this function may cause a subsequent create() to fail if config could not be matched with the platform-specific configuration.

Note that the actual config used may be differ from the requested values.

gl_config

a configuration structure for configuring the OpenGL context

Returns

whether gl_config could be successfully set on self

Will internally set self as shared with share

share

another GLContext

Set’s the current window on self to window. The window can only be changed before create() has been called and the window is not already running.

window

a GLWindow

Returns

Whether the window was successfully updated

version

a GLSLVersion

profile

a GLSLProfile

Returns

Whether self supports the combination of version with profile

This is supported on crate feature v1_16 only.

version

a GLSLVersion

profile

a GLSLProfile

Returns

whether self supports the ‘precision’ specifier in GLSL shaders

This is supported on crate feature v1_16 only.

version

a GLSLVersion

profile

a GLSLProfile

Returns

whether self supports the ‘precision highp’ specifier in GLSL shaders

Swap the front and back buffers on the window attached to self. This will display the frame on the next refresh cycle.

Implementors

This is supported on crate feature v1_20 only.
This is supported on crate feature v1_20 only.
This is supported on crate feature v1_16 only.
This is supported on crate feature v1_16 only.