Trait glutin::display::GlDisplay

source ·
pub trait GlDisplay: Sealed {
    type WindowSurface: GlSurface<WindowSurface>;
    type PixmapSurface: GlSurface<PixmapSurface>;
    type PbufferSurface: GlSurface<PbufferSurface>;
    type Config: GlConfig;
    type NotCurrentContext: NotCurrentGlContext;

    // Required methods
    unsafe fn find_configs(
        &self,
        template: ConfigTemplate
    ) -> Result<Box<dyn Iterator<Item = Self::Config> + '_>>;
    unsafe fn create_context(
        &self,
        config: &Self::Config,
        context_attributes: &ContextAttributes
    ) -> Result<Self::NotCurrentContext>;
    unsafe fn create_window_surface(
        &self,
        config: &Self::Config,
        surface_attributes: &SurfaceAttributes<WindowSurface>
    ) -> Result<Self::WindowSurface>;
    unsafe fn create_pbuffer_surface(
        &self,
        config: &Self::Config,
        surface_attributes: &SurfaceAttributes<PbufferSurface>
    ) -> Result<Self::PbufferSurface>;
    unsafe fn create_pixmap_surface(
        &self,
        config: &Self::Config,
        surface_attributes: &SurfaceAttributes<PixmapSurface>
    ) -> Result<Self::PixmapSurface>;
    fn get_proc_address(&self, addr: &CStr) -> *const c_void;
    fn version_string(&self) -> String;
    fn supported_features(&self) -> DisplayFeatures;
}
Expand description

A trait to group common display operations.

Required Associated Types§

source

type WindowSurface: GlSurface<WindowSurface>

A window surface created by the display.

source

type PixmapSurface: GlSurface<PixmapSurface>

A pixmap surface created by the display.

source

type PbufferSurface: GlSurface<PbufferSurface>

A pbuffer surface created by the display.

source

type Config: GlConfig

A config that is used by the display.

source

type NotCurrentContext: NotCurrentGlContext

A context that is being used by the display.

Required Methods§

source

unsafe fn find_configs( &self, template: ConfigTemplate ) -> Result<Box<dyn Iterator<Item = Self::Config> + '_>>

Find configurations matching the given template.

Safety

Some platforms use RawWindowHandle to pick configs, so it must point to a valid object if it was passed on crate::config::ConfigTemplate.

source

unsafe fn create_context( &self, config: &Self::Config, context_attributes: &ContextAttributes ) -> Result<Self::NotCurrentContext>

Create the graphics platform context.

Safety

Some platforms use RawWindowHandle for context creation, so it must point to a valid object.

source

unsafe fn create_window_surface( &self, config: &Self::Config, surface_attributes: &SurfaceAttributes<WindowSurface> ) -> Result<Self::WindowSurface>

Create the surface that can be used to render into native window.

Safety

The RawWindowHandle must point to a valid object.

source

unsafe fn create_pbuffer_surface( &self, config: &Self::Config, surface_attributes: &SurfaceAttributes<PbufferSurface> ) -> Result<Self::PbufferSurface>

Create the surface that can be used to render into pbuffer.

Safety

The function is safe in general, but marked as not for compatibility reasons.

source

unsafe fn create_pixmap_surface( &self, config: &Self::Config, surface_attributes: &SurfaceAttributes<PixmapSurface> ) -> Result<Self::PixmapSurface>

Create the surface that can be used to render into pixmap.

Safety

The NativePixmap must represent a valid native pixmap.

source

fn get_proc_address(&self, addr: &CStr) -> *const c_void

Return the address of an OpenGL function.

Api-specific

WGL: - To load all the functions you must have a current context on the calling thread, otherwise only limited set of functions will be loaded.

source

fn version_string(&self) -> String

Helper to obtain the information about the underlying display.

This function is intended to be used for logging purposes to help with troubleshooting issues.

source

fn supported_features(&self) -> DisplayFeatures

Get the features supported by the display.

These features could be used to check that something is supported beforehand instead of doing fallback.

Implementors§