[][src]Trait gtk::GLAreaExt

pub trait GLAreaExt: 'static {
    fn attach_buffers(&self);
fn get_auto_render(&self) -> bool;
fn get_context(&self) -> Option<GLContext>;
fn get_error(&self) -> Option<Error>;
fn get_has_alpha(&self) -> bool;
fn get_has_depth_buffer(&self) -> bool;
fn get_has_stencil_buffer(&self) -> bool;
fn get_required_version(&self) -> (i32, i32);
fn get_use_es(&self) -> bool;
fn make_current(&self);
fn queue_render(&self);
fn set_auto_render(&self, auto_render: bool);
fn set_error(&self, error: Option<&Error>);
fn set_has_alpha(&self, has_alpha: bool);
fn set_has_depth_buffer(&self, has_depth_buffer: bool);
fn set_has_stencil_buffer(&self, has_stencil_buffer: bool);
fn set_required_version(&self, major: i32, minor: i32);
fn set_use_es(&self, use_es: bool);
fn connect_create_context<F: Fn(&Self) -> Option<GLContext> + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_render<F: Fn(&Self, &GLContext) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_resize<F: Fn(&Self, i32, i32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_auto_render_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_context_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_has_alpha_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_has_depth_buffer_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_has_stencil_buffer_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_use_es_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all GLArea methods.

Feature: v3_16

Implementors

GLArea

Required methods

fn attach_buffers(&self)

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

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

Feature: v3_16

fn get_auto_render(&self) -> bool

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

Feature: v3_16

Returns

true if the self is auto rendering, false otherwise

fn get_context(&self) -> Option<GLContext>

Retrieves the gdk::GLContext used by self.

Feature: v3_16

Returns

the gdk::GLContext

fn get_error(&self) -> Option<Error>

Gets the current error set on the self.

Feature: v3_16

Returns

the glib::Error or None

fn get_has_alpha(&self) -> bool

Returns whether the area has an alpha component.

Feature: v3_16

Returns

true if the self has an alpha component, false otherwise

fn get_has_depth_buffer(&self) -> bool

Returns whether the area has a depth buffer.

Feature: v3_16

Returns

true if the self has a depth buffer, false otherwise

fn get_has_stencil_buffer(&self) -> bool

Returns whether the area has a stencil buffer.

Feature: v3_16

Returns

true if the self has a stencil buffer, false otherwise

fn get_required_version(&self) -> (i32, i32)

Retrieves the required version of OpenGL set using GLAreaExt::set_required_version.

Feature: v3_16

major

return location for the required major version

minor

return location for the required minor version

fn get_use_es(&self) -> bool

Retrieves the value set by GLAreaExt::set_use_es.

Feature: v3_22

Returns

true if the GLArea should create an OpenGL ES context and false otherwise

fn make_current(&self)

Ensures that the gdk::GLContext used by self is associated with the GLArea.

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

Feature: v3_16

fn queue_render(&self)

Marks the currently rendered data (if any) as invalid, and queues a redraw of the widget, ensuring that the GLArea::render signal is emitted during the draw.

This is only needed when the GLAreaExt::set_auto_render has been called with a false value. The default behaviour is to emit GLArea::render on each draw.

Feature: v3_16

fn set_auto_render(&self, auto_render: bool)

If auto_render is true the 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 GLAreaExt::queue_render must be called. This mode is useful when the scene changes seldomly, but takes a long time to redraw.

Feature: v3_16

auto_render

a boolean

fn set_error(&self, error: Option<&Error>)

Sets an error on the area which will be shown instead of the GL rendering. This is useful in the GLArea::create-context signal if GL context creation fails.

Feature: v3_16

error

a new glib::Error, or None to unset the error

fn set_has_alpha(&self, has_alpha: bool)

If has_alpha is true the buffer allocated by the widget will have an alpha channel component, and when rendering to the window the result will be composited over whatever is below the widget.

If has_alpha is false there will be no alpha channel, and the buffer will fully replace anything below the widget.

Feature: v3_16

has_alpha

true to add an alpha component

fn set_has_depth_buffer(&self, has_depth_buffer: bool)

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

Feature: v3_16

has_depth_buffer

true to add a depth buffer

fn set_has_stencil_buffer(&self, has_stencil_buffer: bool)

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

Feature: v3_16

has_stencil_buffer

true to add a stencil buffer

fn set_required_version(&self, major: i32, minor: i32)

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.

Feature: v3_16

major

the major version

minor

the minor version

fn set_use_es(&self, use_es: bool)

Sets whether the self should create an OpenGL or an OpenGL ES context.

You should check the capabilities of the gdk::GLContext before drawing with either API.

Feature: v3_22

use_es

whether to use OpenGL or OpenGL ES

fn connect_create_context<F: Fn(&Self) -> Option<GLContext> + 'static>(
    &self,
    f: F
) -> SignalHandlerId

The ::create-context signal is emitted when the widget is being realized, and 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 GLAreaExt::set_error to register a more detailed error of how the construction failed.

Feature: v3_16

Returns

a newly created gdk::GLContext; the GLArea widget will take ownership of the returned value.

fn connect_render<F: Fn(&Self, &GLContext) -> Inhibit + 'static>(
    &self,
    f: F
) -> SignalHandlerId

The ::render signal is emitted every time the contents of the GLArea should be redrawn.

The context is bound to the area prior to emitting this function, and the buffers are painted to the window once the emission terminates.

Feature: v3_16

context

the gdk::GLContext used by area

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

fn connect_resize<F: Fn(&Self, i32, i32) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

The ::resize signal is 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.

Feature: v3_16

width

the width of the viewport

height

the height of the viewport

fn connect_property_auto_render_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_context_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_has_alpha_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_has_depth_buffer_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_has_stencil_buffer_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_use_es_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Loading content...

Implementors

impl<O: IsA<GLArea>> GLAreaExt for O[src]

Loading content...