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§
sourcetype WindowSurface: GlSurface<WindowSurface>
type WindowSurface: GlSurface<WindowSurface>
A window surface created by the display.
sourcetype PixmapSurface: GlSurface<PixmapSurface>
type PixmapSurface: GlSurface<PixmapSurface>
A pixmap surface created by the display.
sourcetype PbufferSurface: GlSurface<PbufferSurface>
type PbufferSurface: GlSurface<PbufferSurface>
A pbuffer surface created by the display.
sourcetype NotCurrentContext: NotCurrentGlContext
type NotCurrentContext: NotCurrentGlContext
A context that is being used by the display.
Required Methods§
sourceunsafe fn find_configs(
&self,
template: ConfigTemplate
) -> Result<Box<dyn Iterator<Item = Self::Config> + '_>>
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
.
sourceunsafe fn create_context(
&self,
config: &Self::Config,
context_attributes: &ContextAttributes
) -> Result<Self::NotCurrentContext>
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.
sourceunsafe fn create_window_surface(
&self,
config: &Self::Config,
surface_attributes: &SurfaceAttributes<WindowSurface>
) -> Result<Self::WindowSurface>
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.
sourceunsafe fn create_pbuffer_surface(
&self,
config: &Self::Config,
surface_attributes: &SurfaceAttributes<PbufferSurface>
) -> Result<Self::PbufferSurface>
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.
sourceunsafe fn create_pixmap_surface(
&self,
config: &Self::Config,
surface_attributes: &SurfaceAttributes<PixmapSurface>
) -> Result<Self::PixmapSurface>
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.
sourcefn get_proc_address(&self, addr: &CStr) -> *const c_void
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.
sourcefn version_string(&self) -> String
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.
sourcefn supported_features(&self) -> DisplayFeatures
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§
source§impl GlDisplay for glutin::display::Display
impl GlDisplay for glutin::display::Display
type Config = Config
type NotCurrentContext = NotCurrentContext
type PbufferSurface = Surface<PbufferSurface>
type PixmapSurface = Surface<PixmapSurface>
type WindowSurface = Surface<WindowSurface>
source§impl GlDisplay for glutin::api::egl::display::Display
Available on egl_backend
only.
impl GlDisplay for glutin::api::egl::display::Display
egl_backend
only.type Config = Config
type NotCurrentContext = NotCurrentContext
type PbufferSurface = Surface<PbufferSurface>
type PixmapSurface = Surface<PixmapSurface>
type WindowSurface = Surface<WindowSurface>
source§impl GlDisplay for glutin::api::glx::display::Display
Available on glx_backend
only.
impl GlDisplay for glutin::api::glx::display::Display
glx_backend
only.