pub struct GlVersion {
pub major: u16,
pub minor: u16,
pub is_gles: bool,
}
Fields§
§major: u16
§minor: u16
§is_gles: bool
Implementations§
Source§impl GlVersion
impl GlVersion
pub const fn gl(major: u16, minor: u16) -> Self
pub const fn gles(major: u16, minor: u16) -> Self
pub fn read<G: HasContext>(gl: &G) -> Self
Sourcepub fn parse(gl_version_string: &str) -> Self
pub fn parse(gl_version_string: &str) -> Self
Parse the OpenGL version from the version string queried from the driver
via the GL_VERSION
enum.
Version strings are documented to be in the form
<major>.<minor>[.<release>][ <vendor specific information>]
for full-fat OpenGL, and
OpenGL ES <major>.<minor>[.<release>][ <vendor specific information>]
for OpenGL ES.
Examples based on strings found in the wild:
let version = GlVersion::parse("4.6.0 NVIDIA 465.27");
assert!(!version.is_gles);
assert_eq!(version.major, 4);
assert_eq!(version.minor, 6);
let version = GlVersion::parse("OpenGL ES 3.2 NVIDIA 465.27");
assert!(version.is_gles);
assert_eq!(version.major, 3);
assert_eq!(version.minor, 2);
Sourcepub fn debug_message_insert_support(self) -> bool
pub fn debug_message_insert_support(self) -> bool
Debug messages are provided by glDebugMessageInsert
, which is only
present in OpenGL >= 4.3
Sourcepub fn bind_vertex_array_support(self) -> bool
pub fn bind_vertex_array_support(self) -> bool
Vertex array binding is provided by glBindVertexArray
, which is
not present in OpenGL (ES) <3.0
Sourcepub fn vertex_offset_support(self) -> bool
pub fn vertex_offset_support(self) -> bool
Vertex offset support is provided by glDrawElementsBaseVertex
, which is
only present from OpenGL 3.2 and above.
Sourcepub fn bind_sampler_support(self) -> bool
pub fn bind_sampler_support(self) -> bool
Separate binding of sampler (glBindSampler
) is supported from OpenGL
3.2 or ES 3.0
Sourcepub fn clip_origin_support(self) -> bool
pub fn clip_origin_support(self) -> bool
Setting the clip origin (GL_CLIP_ORIGIN
) is suppoted from OpenGL 4.5