### Refer to Context Initialization Source: https://github.com/grovesnl/glow/blob/main/_autodocs/README.md Directs the user to the context initialization documentation. This is the second step in the getting started process. ```shell → see context-initialization.md ``` -------------------------------- ### Open Overview Document Source: https://github.com/grovesnl/glow/blob/main/_autodocs/README.md Opens the overview markdown file. This is the first step in getting started with the Glow project. ```shell → open overview.md ``` -------------------------------- ### Example Usage of Version Source: https://github.com/grovesnl/glow/blob/main/_autodocs/types-and-structures.md Demonstrates how to retrieve the current GL version and check for feature availability based on major and minor version numbers. ```rust let version = gl.version(); if version.major >= 4 && version.minor >= 5 { // GL 4.5+ features available } ``` -------------------------------- ### Create and Use Shader Program Source: https://github.com/grovesnl/glow/blob/main/_autodocs/README.md Follows the quick reference guide to create and use a shader program, a key step in rendering graphics. ```shell → follow quick-reference.md → "Create and Use a Shader Program" ``` -------------------------------- ### Example: Configure Depth Renderbuffer Source: https://github.com/grovesnl/glow/blob/main/_autodocs/drawing-and-framebuffers.md Binds a renderbuffer and sets its storage to a 24-bit depth component format with specified dimensions. ```rust unsafe { gl.bind_renderbuffer(glow::RENDERBUFFER, Some(depth_buffer)); gl.renderbuffer_storage( glow::RENDERBUFFER, glow::DEPTH_COMPONENT24, 1024, 768 ); } ``` -------------------------------- ### Get Supported Extensions Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Returns the set of all supported extensions for this context. Extensions are automatically detected during context creation. ```rust pub fn supported_extensions(&self) -> &HashSet ``` ```rust let extensions = gl.supported_extensions(); if extensions.contains("GL_ARB_compute_shader") { // Compute shaders are available } ``` -------------------------------- ### Begin query recording Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Starts recording query results for a specified target. The `target` parameter can be one of several predefined query types. ```rust pub unsafe fn begin_query(&self, target: u32, query: Query) ``` -------------------------------- ### Get GL Version Information Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Returns parsed GL version information. Use this to check minimum version requirements. ```rust pub fn version(&self) -> &Version ``` ```rust let version = gl.version(); if version.major >= 4 && version.minor >= 1 { // Can use GL 4.1+ features } ``` -------------------------------- ### Get Program Link Status Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Checks if the linking of an OpenGL program was successful. ```rust pub unsafe fn get_program_link_status(&self, program: Program) -> bool ``` -------------------------------- ### Get Program Info Log Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves the log containing information about linking or validation errors and warnings for an OpenGL program. ```rust pub unsafe fn get_program_info_log(&self, program: Program) -> String ``` -------------------------------- ### Get Program Binary Data Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves the binary representation of an OpenGL program. This can be used for caching or offline compilation. ```rust pub unsafe fn get_program_binary(&self, program: Program) -> Option ``` -------------------------------- ### Get Component Count Per Pixel Format Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Returns the number of color components for a given GL pixel format. Panics if the format is unsupported. ```rust pub fn components_per_format(format: u32) -> usize ``` -------------------------------- ### Build the Project Source: https://github.com/grovesnl/glow/blob/main/examples/howto/README.md Use this command to build the project. ```shell cargo run ``` -------------------------------- ### Get 32-bit Float GL Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Gets a 32-bit float GL parameter. ```rust pub unsafe fn get_parameter_f32(&self, parameter: u32) -> f32 ``` -------------------------------- ### Get Boolean GL Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Gets a boolean GL parameter. Alias: `glGetBooleanv`. ```rust pub unsafe fn get_parameter_bool(&self, parameter: u32) -> bool ``` -------------------------------- ### Get 32-bit Signed Integer GL Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Gets a 32-bit signed integer GL parameter. ```rust pub unsafe fn get_parameter_i32(&self, parameter: u32) -> i32 ``` -------------------------------- ### Build Glow for Native Source: https://github.com/grovesnl/glow/blob/main/README.md Use this command to build the Glow project for native execution. ```sh cargo build ``` -------------------------------- ### Get 64-bit query result Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Retrieves a 64-bit result from a query, typically used for timer queries to get elapsed time. ```rust pub unsafe fn get_query_parameter_u64(&self, query: Query, parameter: u32) -> u64 ``` -------------------------------- ### Run Native with Glutin/Winit Source: https://github.com/grovesnl/glow/blob/main/examples/hello/README.md Execute the project natively using the glutin and winit backends. Ensure the 'glutin_winit' feature is enabled. ```shell cargo run --features=glutin_winit ``` -------------------------------- ### Get Fragment Data Location Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Gets the color attachment index for a fragment shader output variable. Returns -1 if not found. ```rust pub unsafe fn get_frag_data_location(&self, program: Program, name: &str) -> i32 ``` -------------------------------- ### get_frag_data_location Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Gets the color attachment index for a fragment shader output variable. ```APIDOC ## get_frag_data_location ### Description Gets the color attachment index for a fragment shader output variable. ### Method `unsafe fn get_frag_data_location(&self, program: Program, name: &str) -> i32` ### Parameters #### Path Parameters - **program** (Program) - Required - The program object. - **name** (str) - Required - The name of the fragment shader output variable. ### Returns - **i32** - Color attachment index or -1 if not found. ``` -------------------------------- ### Create and Use a Shader Program Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Create, compile, link, and use a shader program. Ensure shaders are compiled successfully before linking. ```rust unsafe { // Create program let program = gl.create_program().unwrap(); // Compile shaders let vertex = gl.create_shader(glow::VERTEX_SHADER).unwrap(); gl.shader_source(vertex, VERTEX_GLSL); gl.compile_shader(vertex); let fragment = gl.create_shader(glow::FRAGMENT_SHADER).unwrap(); gl.shader_source(fragment, FRAGMENT_GLSL); gl.compile_shader(fragment); // Link gl.attach_shader(program, vertex); gl.attach_shader(program, fragment); gl.link_program(program); // Check status if !gl.get_program_link_status(program) { eprintln!("{}", gl.get_program_info_log(program)); } // Use gl.use_program(Some(program)); } ``` -------------------------------- ### Run Native with SDL2 Source: https://github.com/grovesnl/glow/blob/main/examples/hello/README.md Execute the project natively using the sdl2 backend. Ensure the 'sdl2' feature is enabled. ```shell cargo run --features=sdl2 ``` -------------------------------- ### begin_transform_feedback Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Begins the recording of transform feedback. Vertex shader output will be captured into buffers. ```APIDOC ## begin_transform_feedback ### Description Begins transform feedback recording. Output from vertex/geometry shaders is captured. ### Method `pub unsafe fn begin_transform_feedback(&self, primitive_mode: u32)` ### Parameters #### Path Parameters - **primitive_mode** (u32) - Required - Primitive type (POINTS, LINES, TRIANGLES) ``` -------------------------------- ### Get shader info log Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves the compilation error or warning log for a shader. ```rust pub unsafe fn get_shader_info_log(&self, shader: Shader) -> String ``` -------------------------------- ### Get Float Texture Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/textures-and-sampling.md Queries a float texture parameter. Requires unsafe block. ```rust pub unsafe fn get_tex_parameter_f32(&self, target: u32, parameter: u32) -> f32 ``` -------------------------------- ### Get Integer Texture Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/textures-and-sampling.md Queries an integer texture parameter. Requires unsafe block. ```rust pub unsafe fn get_tex_parameter_i32(&self, target: u32, parameter: u32) -> i32 ``` -------------------------------- ### Get Program Validation Status Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Checks if an OpenGL program has passed validation, indicating it can be executed. ```rust pub unsafe fn get_program_validate_status(&self, program: Program) -> bool ``` -------------------------------- ### Build for Web with Web-Sys Source: https://github.com/grovesnl/glow/blob/main/examples/hello/README.md Compile the project for the web target using web-sys. This involves building for wasm32-unknown-unknown, using wasm-bindgen, and copying necessary files. ```shell cargo build --target wasm32-unknown-unknown mkdir -p generated wasm-bindgen ../../target/wasm32-unknown-unknown/debug/hello.wasm --out-dir generated --target web cp index.html generated ``` -------------------------------- ### Get Integer Buffer Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/buffers-and-vertex-arrays.md Retrieves an integer parameter for a specified buffer target, such as `BUFFER_SIZE` or `BUFFER_USAGE`. ```rust pub unsafe fn get_buffer_parameter_i32(&self, target: u32, parameter: u32) -> i32 ``` -------------------------------- ### Create an OpenGL Program Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Creates an empty program object. Shaders must be attached and the program linked before use. ```rust pub unsafe fn create_program(&self) -> Result ``` ```rust unsafe { let program = gl.create_program() .expect("Failed to create program"); } ``` -------------------------------- ### Get 32-bit query result Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Retrieves a 32-bit result from a query. Used for parameters like `QUERY_RESULT` or `QUERY_RESULT_AVAILABLE`. ```rust pub unsafe fn get_query_parameter_u32(&self, query: Query, parameter: u32) -> u32 ``` -------------------------------- ### Build Glow for WebAssembly Source: https://github.com/grovesnl/glow/blob/main/README.md Use this command to build the Glow project targeting WebAssembly with web-sys. ```sh cargo build --target wasm32-unknown-unknown ``` -------------------------------- ### Get Sampler Integer Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/textures-and-sampling.md Queries and retrieves the current value of an integer parameter for a given sampler object. ```rust pub unsafe fn get_sampler_parameter_i32(&self, sampler: Sampler, parameter: u32) -> i32 ``` -------------------------------- ### Initialization & Context Source: https://github.com/grovesnl/glow/blob/main/_autodocs/INDEX.md Functions for creating and managing the OpenGL context, retrieving version information, and listing supported extensions. ```APIDOC ## Initialization & Context ### Description Functions for creating and managing the OpenGL context, retrieving version information, and listing supported extensions. ### Methods - `Context::from_loader_function()` - `Context::from_webgl2_context()` - `gl.version()` - `gl.supported_extensions()` ``` -------------------------------- ### begin_query Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Begins recording query results for a specified target using a given query object. ```APIDOC ## begin_query ### Description Begins recording query results. ### Parameters #### Path Parameters - **target** (u32) - Required - Query target (SAMPLES_PASSED, ANY_SAMPLES_PASSED, PRIMITIVES_GENERATED, TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, TIME_ELAPSED, TIMESTAMP) - **query** (Query) - Required - Query object ``` -------------------------------- ### Get Uniform Location Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Finds the location of a uniform variable within a program. Returns None if the uniform does not exist. ```rust pub unsafe fn get_uniform_location( &self, program: Program, name: &str ) -> Option ``` ```rust unsafe { let color_loc = gl.get_uniform_location(program, "color") .expect("color uniform not found"); } ``` -------------------------------- ### create_program Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Creates an empty program object. Shaders must be attached and the program linked before use. ```APIDOC ## create_program ### Description Creates an empty program object. Shaders must be attached and the program linked before use. ### Method `create_program` ### Returns `Result` — Handle to new program ### Example ```rust unsafe { let program = gl.create_program() .expect("Failed to create program"); } ``` ``` -------------------------------- ### Begin Transform Feedback Recording Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Begins transform feedback recording. Vertex or geometry shader output will be captured. ```rust pub unsafe fn begin_transform_feedback(&self, primitive_mode: u32) ``` -------------------------------- ### Initialize Native Glow Context Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Use this snippet to create a Glow context on native platforms. It requires a function to load OpenGL function pointers from your windowing library. ```rust unsafe { let gl = glow::Context::from_loader_function(|s| { window_loader.get_proc_address(s) as *const _ }); } ``` -------------------------------- ### Navigate with Index Source: https://github.com/grovesnl/glow/blob/main/_autodocs/README.md Utilizes the INDEX.md file to find specific sections relevant to user needs within the Glow project documentation. ```shell → Use INDEX.md to find sections for your specific needs ``` -------------------------------- ### Get Number of Active Uniforms Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves the count of active uniforms associated with a given OpenGL program. This is useful for iterating through all uniforms. ```rust pub unsafe fn get_active_uniforms(&self, program: Program) -> u32 ``` -------------------------------- ### Create and Use a Framebuffer Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Create a framebuffer with a color attachment and a depth renderbuffer. Check the framebuffer status to ensure it is complete before use. ```rust unsafe { let fb = gl.create_framebuffer().unwrap(); gl.bind_framebuffer(glow::FRAMEBUFFER, Some(fb)); let color_tex = gl.create_texture().unwrap(); // ... configure color_tex ... gl.framebuffer_texture( glow::FRAMEBUFFER, glow::COLOR_ATTACHMENT0, Some(color_tex), 0 ); let depth_rb = gl.create_renderbuffer().unwrap(); gl.bind_renderbuffer(glow::RENDERBUFFER, Some(depth_rb)); gl.renderbuffer_storage( glow::RENDERBUFFER, glow::DEPTH_COMPONENT24, width as i32, height as i32 ); gl.framebuffer_renderbuffer( glow::FRAMEBUFFER, glow::DEPTH_ATTACHMENT, glow::RENDERBUFFER, Some(depth_rb) ); let status = gl.check_framebuffer_status(glow::FRAMEBUFFER); if status != glow::FRAMEBUFFER_COMPLETE { eprintln!("FB incomplete: {}", status); } } ``` -------------------------------- ### Get Bytes Per Component Type Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Returns the byte size for a given GL pixel type. Panics if the type is unsupported. ```rust pub fn bytes_per_type(pixel_type: u32) -> usize ``` -------------------------------- ### finish Source: https://github.com/grovesnl/glow/blob/main/_autodocs/drawing-and-framebuffers.md Waits for all GL commands to complete execution. ```APIDOC ## finish ### Description Waits for all GL commands to complete. ### Method `finish` ``` -------------------------------- ### Set Multiple Draw Buffers (DSA) Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Sets multiple draw buffers for a framebuffer without binding it. Useful for multi-render-target setups. ```rust pub unsafe fn named_framebuffer_draw_buffers( &self, framebuffer: Option, buffers: &[u32] ) ``` -------------------------------- ### Web GL2 Context Initialization Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Initializes a WebGL2 context for web applications, requiring a canvas element. ```rust let gl = Context::from_webgl2_context(canvas.get_context("webgl2")?); ``` -------------------------------- ### Get Program Completion Status Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves the completion status of an OpenGL program's linking or compilation, particularly useful for asynchronous operations. ```rust pub unsafe fn get_program_completion_status(&self, program: Program) -> bool ``` -------------------------------- ### Create Fence for Synchronization Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Creates a fence to synchronize CPU and GPU execution. Use SYNC_GPU_COMMANDS_COMPLETE for condition and 0 or SYNC_FLUSH_COMMANDS_BIT for flags. ```rust pub unsafe fn fence_sync(&self, condition: u32, flags: u32) -> Result ``` ```rust unsafe { let fence = gl.fence_sync(glow::SYNC_GPU_COMMANDS_COMPLETE, 0) .expect("Failed to create fence"); // Do some work... let status = gl.client_wait_sync(fence, 0, 1_000_000_000); // 1 second timeout gl.delete_sync(fence); } ``` -------------------------------- ### Native GL Context Initialization Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Initializes a GL context for native applications using a custom loader function. ```rust let gl = Context::from_loader_function(|s| { display.get_proc_address(s) as *const _ }); ``` -------------------------------- ### program_binary_retrievable_hint Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Hints to the driver that the program binary should be retrievable. ```APIDOC ## program_binary_retrievable_hint ### Description Hints to the driver that the program binary should be retrievable. ### Method `program_binary_retrievable_hint` ### Parameters #### Path Parameters - `program` (Program) - Required - The program to set the hint for. - `value` (bool) - Required - `true` to hint that the binary should be retrievable, `false` otherwise. ``` -------------------------------- ### scissor_array_slice Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Sets scissor boxes for multiple viewports. This is an efficient way to manage scissor regions for layered rendering or complex viewport setups. ```APIDOC ## scissor_array_slice ### Description Sets scissor boxes for multiple viewports. ### Method `unsafe fn scissor_array_slice(&self, first: u32, scissors: &[[i32; 4]])` ### Parameters #### Path Parameters - **first** (u32) - Required - Index of the first scissor box to update. - **scissors** (&[[i32; 4]]) - Required - An array of scissor boxes, where each box is represented as `[x, y, width, height]`. ``` -------------------------------- ### Native OpenGL Context Initialization Source: https://github.com/grovesnl/glow/blob/main/_autodocs/overview.md Initializes a native OpenGL context using a provided loader function for GL entry points. This is used for desktop and mobile platforms. ```rust use glow::* unsafe { // Create context from loader function let gl = Context::from_loader_function(|s| { // Get proc address for GL function name your_loader(s) }); // Can also use CStr version let gl = Context::from_loader_function_cstr(|s| { your_cstr_loader(s) }); } ``` -------------------------------- ### Get Integer Program Parameter Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves an integer value for a specified program parameter. Used for status checks, log lengths, and attribute/uniform counts. ```rust pub unsafe fn get_program_parameter_i32(&self, program: Program, parameter: u32) -> i32 ``` -------------------------------- ### Create a Texture Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Create and configure a 2D texture with specified filtering and wrapping modes. Ensure pixel data is correctly formatted and sized. ```rust unsafe { let texture = gl.create_texture().unwrap(); gl.bind_texture(glow::TEXTURE_2D, Some(texture)); gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_MIN_FILTER, glow::LINEAR as i32); gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_MAG_FILTER, glow::LINEAR as i32); gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_S, glow::REPEAT as i32); gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_T, glow::REPEAT as i32); gl.tex_image_2d( glow::TEXTURE_2D, 0, glow::RGBA as i32, width as i32, height as i32, 0, glow::RGBA, glow::UNSIGNED_BYTE, glow::PixelUnpackData::Slice(Some(pixel_data)) ); } ``` -------------------------------- ### Upload Vertex Data Source: https://github.com/grovesnl/glow/blob/main/_autodocs/README.md Instructions for uploading vertex data, a necessary step after setting up a shader program for rendering. ```shell → then "Upload Vertex Data" ``` -------------------------------- ### get_program_resource_i32 Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Queries program resource properties. ```APIDOC ## get_program_resource_i32 ### Description Queries program resource properties. ### Method `unsafe fn get_program_resource_i32(&self, program: Program, interface: u32, index: u32, properties: &[u32]) -> Vec` ### Parameters #### Path Parameters - **program** (Program) - Required - The program object. - **interface** (u32) - Required - The interface type (e.g., UNIFORM, UNIFORM_BLOCK). - **index** (u32) - Required - The index of the resource. - **properties** (slice of u32) - Required - The properties to query. ### Returns - **Vec** - A vector of queried program resource properties. ``` -------------------------------- ### Get shader precision format Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves information about the precision of floating-point or integer types for a given shader type and precision mode. Returns None if not available. ```rust pub unsafe fn get_shader_precision_format( &self, shader_type: u32, precision_mode: u32 ) -> Option ``` -------------------------------- ### program_binary Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Loads a previously saved program binary into the specified program. ```APIDOC ## program_binary ### Description Loads a previously saved program binary into the specified program. ### Method `program_binary` ### Parameters #### Path Parameters - `program` (Program) - Required - The program to load the binary into. - `binary` (ProgramBinary) - Required - The program binary to load, containing `{buffer: Vec, format: u32}`. ``` -------------------------------- ### Get Specific Active Uniform Information Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Fetches details about a specific active uniform by its index. Returns an Option containing the uniform's size, type, and name. ```rust pub unsafe fn get_active_uniform( &self, program: Program, index: u32 ) -> Option ``` -------------------------------- ### Allocate and Initialize GPU Buffer from Bytes (Rust) Source: https://github.com/grovesnl/glow/blob/main/_autodocs/buffers-and-vertex-arrays.md Allocates and initializes buffer memory directly from a byte slice. Useful for uploading raw data to the GPU. ```rust unsafe { let vertices = vec![0.0_f32, 1.0, -1.0, 0.0]; let vertex_bytes = vertices.iter().flat_map(|f| f.to_le_bytes()).collect::>(); gl.buffer_data_u8_slice(glow::ARRAY_BUFFER, &vertex_bytes, glow::STATIC_DRAW); } ``` -------------------------------- ### Draw Arrays Instanced Base Instance Function Signature Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md This function draws arrays with instancing, specifying a starting instance index. It allows for efficient rendering of multiple instances of the same geometry with a unique base instance ID for each. ```rust pub unsafe fn draw_arrays_instanced_base_instance( &self, mode: u32, first: i32, count: i32, instance_count: i32, base_instance: u32 ) ``` -------------------------------- ### Synchronization & Queries Source: https://github.com/grovesnl/glow/blob/main/_autodocs/INDEX.md Functions for CPU-GPU synchronization, creating query objects, recording queries, and retrieving query results. ```APIDOC ## Synchronization & Queries ### Description Functions for CPU-GPU synchronization, creating query objects, recording queries, and retrieving query results. ### Methods - `fence_sync()` - `wait_sync()` - `create_query()` - `begin_query()` - `end_query()` - `get_query_parameter_u64()` ``` -------------------------------- ### Load Program Binary Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Loads a previously saved program binary into the specified OpenGL program. This can speed up program loading. ```rust pub unsafe fn program_binary(&self, program: Program, binary: &ProgramBinary) ``` -------------------------------- ### Buffer Usage Hints Source: https://github.com/grovesnl/glow/blob/main/_autodocs/constants-reference.md Constants indicating how buffer data will be used. These hints help optimize buffer operations. ```rust pub const STREAM_DRAW: u32 = 0x88E0; pub const STREAM_READ: u32 = 0x88E1; pub const STREAM_COPY: u32 = 0x88E2; pub const STATIC_DRAW: u32 = 0x88E4; pub const STATIC_READ: u32 = 0x88E5; pub const STATIC_COPY: u32 = 0x88E6; pub const DYNAMIC_DRAW: u32 = 0x88E8; pub const DYNAMIC_READ: u32 = 0x88E9; pub const DYNAMIC_COPY: u32 = 0x88EA; ``` -------------------------------- ### Create Native GL Context with String Loader Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Use this function when your loader accepts function names as Rust string slices. It initializes a GL context by loading function pointers. ```rust pub unsafe fn from_loader_function(loader_function: F) -> Context where F: FnMut(&str) -> *const std::os::raw::c_void ``` ```rust unsafe { let gl = Context::from_loader_function(|s| { // Using glutin example gl_display.get_proc_address(s) as *const _ }); } ``` -------------------------------- ### Version Struct Source: https://github.com/grovesnl/glow/blob/main/_autodocs/types-and-structures.md Represents parsed OpenGL version information. Use the `parse` method to create an instance from a version string. ```rust pub struct Version { pub major: u32, pub minor: u32, pub patch: Option, pub suffix: String, pub is_embedded: bool, } ``` -------------------------------- ### Hint Program Binary Retrievability Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Informs the OpenGL driver about the intention to retrieve the program binary later. This can potentially optimize binary storage and retrieval. ```rust pub unsafe fn program_binary_retrievable_hint(&self, program: Program, value: bool) ``` -------------------------------- ### Link OpenGL Program Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Links the program. Check `get_program_link_status` to verify success. Handles potential linking errors by retrieving and printing the info log. ```rust pub unsafe fn link_program(&self, program: Program) ``` ```rust unsafe { gl.link_program(program); let linked = gl.get_program_link_status(program); if !linked { let log = gl.get_program_info_log(program); eprintln!("Link failed: {}", log); } } ``` -------------------------------- ### Version Struct Methods Source: https://github.com/grovesnl/glow/blob/main/_autodocs/types-and-structures.md Provides methods for creating and parsing version information. The `new` and `new_embedded` methods construct Version instances, while `parse` attempts to create one from a string. ```rust pub fn new(major: u32, minor: u32, patch: Option, suffix: String) -> Self ``` ```rust pub fn new_embedded(major: u32, minor: u32, suffix: String) -> Self ``` ```rust pub fn parse(version_string: &str) -> Option ``` -------------------------------- ### Draw Scene Elements Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Clear buffers, set the viewport, bind the shader program and vertex array, set uniforms, and issue draw calls. Remember to swap buffers after drawing. ```rust unsafe { gl.clear_color(0.1, 0.1, 0.1, 1.0); gl.clear(glow::COLOR_BUFFER_BIT | glow::DEPTH_BUFFER_BIT); gl.viewport(0, 0, width as i32, height as i32); gl.use_program(Some(program)); gl.bind_vertex_array(Some(vertex_array)); // Set uniforms if let Some(loc) = gl.get_uniform_location(program, "projection") { gl.uniform_matrix_4_f32_slice(&Some(loc), false, &matrix); } // Draw gl.draw_arrays(glow::TRIANGLES, 0, 36); // Swap buffers (platform-specific, not glow) } ``` -------------------------------- ### get_program_binary Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Retrieves the binary representation of a program. ```APIDOC ## get_program_binary ### Description Retrieves the binary representation of a given program. ### Method `get_program_binary` ### Parameters #### Path Parameters - `program` (Program) - Required - The program to query. ### Returns - `Option` - Contains `{buffer: Vec, format: u32}` if the binary is available, otherwise `None`. ``` -------------------------------- ### supported_extensions Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Retrieves the set of all supported OpenGL extensions for the current context. Extensions are detected automatically during context creation. ```APIDOC ## supported_extensions ### Description Returns the set of all supported extensions for this context. Extensions are automatically detected during context creation. ### Method `supported_extensions(&self) -> &HashSet` ### Returns `&HashSet` — Set of supported extension names ### Example ```rust let extensions = gl.supported_extensions(); if extensions.contains("GL_ARB_compute_shader") { // Compute shaders are available } ``` ``` -------------------------------- ### fence_sync Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Creates a fence to synchronize CPU and GPU execution. Fences are used to signal the completion of GPU operations. ```APIDOC ## fence_sync ### Description Creates a fence to synchronize CPU and GPU execution. Fences are used to signal the completion of GPU operations. ### Method `unsafe fn fence_sync(&self, condition: u32, flags: u32) -> Result` ### Parameters #### Path Parameters - **condition** (u32) - Required - Sync condition (e.g., `SYNC_GPU_COMMANDS_COMPLETE`). - **flags** (u32) - Required - Sync flags (e.g., 0 or `SYNC_FLUSH_COMMANDS_BIT`). ### Response #### Success Response (200) - **Fence** - A handle to the created fence. #### Error Response - **String** - An error message if fence creation fails. ### Request Example ```rust unsafe { let fence = gl.fence_sync(glow::SYNC_GPU_COMMANDS_COMPLETE, 0) .expect("Failed to create fence"); // ... do work ... gl.delete_sync(fence); } ``` ``` -------------------------------- ### from_loader_function Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Creates a new native GL context by loading function pointers from a loader function. The loader receives the function name as a Rust string slice and must return the address of the GL function or null if not available. Panics if reading GL_VERSION fails or GL context is not active. ```APIDOC ## from_loader_function ### Description Creates a new native GL context by loading function pointers from a loader function. The loader receives the function name as a Rust string slice and must return the address of the GL function or null if not available. ### Method unsafe fn from_loader_function(loader_function: F) -> Context where F: FnMut(&str) -> *const std::os::raw::c_void ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **loader_function** (FnMut(&str) -> *const c_void) - Required - Function that returns the address of a GL function by name ### Request Example ```rust unsafe { let gl = Context::from_loader_function(|s| { // Using glutin example gl_display.get_proc_address(s) as *const _ }); } ``` ### Response #### Success Response (200) - **Context** (Context) - A fully initialized GL context #### Response Example ```json { "example": "Context" } ``` **Throws**: Panics if reading `GL_VERSION` fails or GL context is not active ``` -------------------------------- ### Create Glow Context from WebGL1 Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Creates a Glow context from a native WebGL1 context. Provides access to WebGL 1.0 features only. Requires a WebGL 1.0 rendering context from the browser. ```rust pub fn from_webgl1_context(webgl1_context: web_sys::WebGlRenderingContext) -> Context ``` -------------------------------- ### Draw Command Source: https://github.com/grovesnl/glow/blob/main/_autodocs/README.md The final step in the basic rendering pipeline, instructing to 'Draw' after data and shaders are set up. ```shell → then "Draw" ``` -------------------------------- ### bind_renderbuffer Source: https://github.com/grovesnl/glow/blob/main/_autodocs/drawing-and-framebuffers.md Binds a renderbuffer for configuration. ```APIDOC ## bind_renderbuffer ### Description Binds a renderbuffer for configuration. ### Method `pub unsafe fn bind_renderbuffer(&self, target: u32, renderbuffer: Option)` ``` -------------------------------- ### version Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Retrieves parsed OpenGL version information. This method is useful for checking minimum version requirements before using specific features. ```APIDOC ## version ### Description Returns parsed GL version information. Use this to check minimum version requirements. ### Method `version(&self) -> &Version` ### Returns `&Version` — The GL version information ### Example ```rust let version = gl.version(); if version.major >= 4 && version.minor >= 1 { // Can use GL 4.1+ features } ``` ``` -------------------------------- ### WebGL Context Initialization Source: https://github.com/grovesnl/glow/blob/main/_autodocs/overview.md Initializes a WebGL 2.0 context from an HTML canvas element for use in WebAssembly applications. Requires `wasm-bindgen` and `web-sys`. ```rust use glow::* use wasm_bindgen::JsCast; unsafe { let canvas = web_sys::window() .unwrap() .document() .unwrap() .get_element_by_id("canvas") .unwrap() .dyn_into::() .unwrap(); let webgl2_context = canvas .get_context("webgl2") .unwrap() .unwrap() .dyn_into::() .unwrap(); let gl = Context::from_webgl2_context(webgl2_context); } ``` -------------------------------- ### create_sampler Source: https://github.com/grovesnl/glow/blob/main/_autodocs/textures-and-sampling.md Creates a sampler object that encapsulates sampling parameters. ```APIDOC ## create_sampler ### Description Creates a sampler object that encapsulates sampling parameters (separate from texture state). ### Method (Implicitly a method call on a texture object) ### Returns - **Result**: New sampler handle or an error string. ``` -------------------------------- ### Create Native GL Context with C-String Loader Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md This variant is suitable when your loader function expects function names as C-strings. It also initializes a GL context by loading function pointers. ```rust pub unsafe fn from_loader_function_cstr(loader_function: F) -> Context where F: FnMut(&CStr) -> *const std::os::raw::c_void ``` ```rust unsafe { let gl = Context::from_loader_function_cstr(|s| { your_c_str_loader(s) as *const _ }); } ``` -------------------------------- ### Create Glow Context from WebGL2 Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Creates a Glow context from a native WebGL2 context. This wraps the web_sys bindings and enables all WebGL 2.0 functionality. Requires a WebGL 2.0 rendering context from the browser. ```rust pub fn from_webgl2_context(webgl2_context: web_sys::WebGl2RenderingContext) -> Context ``` ```rust use wasm_bindgen::JsCast; unsafe { let canvas = web_sys::window() .unwrap() .document() .unwrap() .get_element_by_id("canvas") .unwrap() .dyn_into::() .unwrap(); let webgl2 = canvas .get_context("webgl2") .unwrap() .unwrap() .dyn_into::() .unwrap(); let gl = Context::from_webgl2_context(webgl2); } ``` -------------------------------- ### Set Driver Hints Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Provides hints to the driver about performance priorities. Use for optimizing rendering based on target hardware capabilities. ```rust pub unsafe fn hint(&self, target: u32, mode: u32) ``` -------------------------------- ### from_webgl2_context Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Creates a glow context from a native WebGL2 context. This wraps the web_sys bindings and enables all WebGL 2.0 functionality. ```APIDOC ## from_webgl2_context ### Description Creates a glow context from a native WebGL2 context. This wraps the web_sys bindings and enables all WebGL 2.0 functionality. ### Method Rust function ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **webgl2_context** (web_sys::WebGl2RenderingContext) - Required - WebGL 2.0 rendering context from browser ### Response #### Success Response - **Context** (Context) - A fully initialized WebGL 2.0 context ### Request Example ```rust use wasm_bindgen::JsCast; unsafe { let canvas = web_sys::window() .unwrap() .document() .unwrap() .get_element_by_id("canvas") .unwrap() .dyn_into::() .unwrap(); let webgl2 = canvas .get_context("webgl2") .unwrap() .unwrap() .dyn_into::() .unwrap(); let gl = Context::from_webgl2_context(webgl2); } ``` ### Response Example None ``` -------------------------------- ### Create a new query object Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Creates a new query object that can be used for occlusion, timer, or other types of queries. Returns a `Result`. ```rust pub unsafe fn create_query(&self) -> Result ``` -------------------------------- ### Upload Compressed 2D Texture Data with compressed_tex_image_2d Source: https://github.com/grovesnl/glow/blob/main/_autodocs/textures-and-sampling.md Uploads pre-compressed 2D texture data. Requires the texture to be in a compressed format. ```rust pub unsafe fn compressed_tex_image_2d( &self, target: u32, level: i32, internal_format: u32, width: i32, height: i32, border: i32, data: &[u8] ) ``` -------------------------------- ### Shaders & Programs Source: https://github.com/grovesnl/glow/blob/main/_autodocs/INDEX.md Functions for compiling shaders, linking programs, managing uniforms, and querying shader information. ```APIDOC ## Shaders & Programs ### Description Functions for compiling shaders, linking programs, managing uniforms, and querying shader information. ### Methods - `create_shader()` - `shader_source()` - `compile_shader()` - `create_program()` - `link_program()` - `get_uniform_location()` - `uniform_*()` - `get_active_uniform()` - `get_active_uniforms()` ``` -------------------------------- ### wait_sync Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Waits for a fence on the GPU. This operation does not block the CPU thread. ```APIDOC ## wait_sync ### Description Waits for a fence on the GPU. This operation does not block the CPU thread. ### Method `unsafe fn wait_sync(&self, fence: Fence, flags: u32, timeout: u64)` ### Parameters #### Path Parameters - **fence** (Fence) - Required - The fence to wait for. - **flags** (u32) - Required - Flags (must be 0). - **timeout** (u64) - Required - Timeout in nanoseconds (`GL_TIMEOUT_IGNORED` for no timeout). ``` -------------------------------- ### Enable GL Debug Output Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Enable and configure OpenGL debug output for detailed error reporting, available on GL 4.3+/ES 3.2+. This requires the `supports_debug` capability. ```rust unsafe { if gl.supports_debug() { gl.enable_debug(); gl.debug_message_callback(Box::new(|source, msg_type, id, severity, message| { eprintln!("[GL Debug] {}", message); })); } } ``` -------------------------------- ### create_query Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Creates a query object for occlusion, timer, or other queries. Returns a new query handle. ```APIDOC ## create_query ### Description Creates a query object for occlusion, timer, or other queries. ### Returns `Result` — New query handle ``` -------------------------------- ### hint Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Provides hints to the driver about performance priorities. This function allows specifying target and mode for hints. ```APIDOC ## hint ### Description Provides hints to the driver about performance priorities. This function allows specifying target and mode for hints. ### Method unsafe fn hint ### Parameters #### Path Parameters - **target** (u32) - Required - Hint target (PERSPECTIVE_CORRECTION_HINT, LINE_SMOOTH_HINT, POLYGON_SMOOTH_HINT, FOG_HINT, etc.) - **mode** (u32) - Required - Hint mode (FASTEST, NICEST, DONT_CARE) ``` -------------------------------- ### from_webgl1_context Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Creates a glow context from a native WebGL1 context. Provides access to WebGL 1.0 features only. ```APIDOC ## from_webgl1_context ### Description Creates a glow context from a native WebGL1 context. Provides access to WebGL 1.0 features only. ### Method Rust function ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **webgl1_context** (web_sys::WebGlRenderingContext) - Required - WebGL 1.0 rendering context from browser ### Response #### Success Response - **Context** (Context) - A fully initialized WebGL 1.0 context ### Request Example None ### Response Example None ``` -------------------------------- ### Set Multiple Scissor Boxes Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Sets scissor boxes for multiple viewports efficiently. ```rust pub unsafe fn scissor_array_slice(&self, first: u32, scissors: &[[i32; 4]]) ``` -------------------------------- ### Create Vertex Array Object (VAO) Source: https://github.com/grovesnl/glow/blob/main/_autodocs/buffers-and-vertex-arrays.md Creates a new Vertex Array Object (VAO) that captures vertex buffer bindings and format. Use this when you need to manage VAOs explicitly. ```rust pub unsafe fn create_vertex_array(&self) -> Result ``` ```rust unsafe { let vertex_array = gl.create_vertex_array() .expect("Failed to create VAO"); gl.bind_vertex_array(Some(vertex_array)); } ``` -------------------------------- ### create_buffer Source: https://github.com/grovesnl/glow/blob/main/_autodocs/buffers-and-vertex-arrays.md Creates a new buffer object. The buffer must be bound and configured before use. ```APIDOC ## create_buffer ### Description Creates a new buffer object. The buffer must be bound and configured before use. ### Returns `Result` — New buffer handle or error ### Example ```rust unsafe { let vertex_buffer = gl.create_buffer() .expect("Failed to create buffer"); gl.bind_buffer(glow::ARRAY_BUFFER, Some(vertex_buffer)); } ``` ``` -------------------------------- ### create_shader Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Creates a new shader object of the specified type. The shader is initially empty and must have source assigned before compilation. ```APIDOC ## create_shader ### Description Creates a new shader object of the specified type. The shader is initially empty and must have source assigned before compilation. ### Method `pub unsafe fn create_shader(&self, shader_type: u32) -> Result` ### Parameters #### Path Parameters - **shader_type** (u32) - Required - Shader type constant (VERTEX_SHADER, FRAGMENT_SHADER, GEOMETRY_SHADER, COMPUTE_SHADER, TESS_CONTROL_SHADER, TESS_EVALUATION_SHADER) ### Returns `Result` — Handle to new shader or error message ### Example ```rust unsafe { let vertex_shader = gl.create_shader(glow::VERTEX_SHADER) .expect("Failed to create vertex shader"); } ``` ``` -------------------------------- ### Force Command Execution Source: https://github.com/grovesnl/glow/blob/main/_autodocs/drawing-and-framebuffers.md Forces the GL to execute all queued commands immediately. This operation does not wait for completion. ```rust pub unsafe fn flush(&self) ``` -------------------------------- ### enable Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Enables a rendering capability. This function allows you to turn on various OpenGL features like depth testing, face culling, and blending. ```APIDOC ## enable ### Description Enables a rendering capability. ### Method `enable` ### Parameters #### Path Parameters - **parameter** (u32) - Required - Capability to enable (BLEND, DEPTH_TEST, CULL_FACE, SCISSOR_TEST, STENCIL_TEST, etc.) ### Request Example ```rust unsafe { gl.enable(glow::DEPTH_TEST); gl.enable(glow::CULL_FACE); gl.enable(glow::BLEND); } ``` ``` -------------------------------- ### Vertex Configuration Source: https://github.com/grovesnl/glow/blob/main/_autodocs/INDEX.md Functions for configuring vertex arrays, enabling vertex attribute arrays, setting attribute layouts, and specifying instance divisors. ```APIDOC ## Vertex Configuration ### Description Functions for configuring vertex arrays, enabling vertex attribute arrays, setting attribute layouts, and specifying instance divisors. ### Methods - `create_vertex_array()` - `enable_vertex_attrib_array()` - `vertex_attrib_pointer_f32()` - `vertex_attrib_divisor()` ``` -------------------------------- ### create_texture Source: https://github.com/grovesnl/glow/blob/main/_autodocs/textures-and-sampling.md Creates a texture object. The texture target must be set when binding or the texture initialized with `create_named_texture`. ```APIDOC ## create_texture ### Description Creates a texture object. The texture target must be set when binding or the texture initialized with `create_named_texture`. ### Method `create_texture` ### Returns - `Result` — New texture handle ### Example ```rust unsafe { let texture = gl.create_texture() .expect("Failed to create texture"); gl.bind_texture(glow::TEXTURE_2D, Some(texture)); } ``` ``` -------------------------------- ### Record a timestamp query Source: https://github.com/grovesnl/glow/blob/main/_autodocs/state-and-synchronization.md Immediately records a timestamp query. This is useful for measuring time intervals. ```rust pub unsafe fn query_counter(&self, query: Query, target: u32) ``` -------------------------------- ### components_per_format Source: https://github.com/grovesnl/glow/blob/main/_autodocs/context-initialization.md Utility function returning the component count for a given pixel format. Panics on unsupported formats. ```APIDOC ## components_per_format ### Description Utility function returning the component count for a given pixel format. Panics on unsupported formats. ### Signature ```rust pub fn components_per_format(format: u32) -> usize ``` ### Parameters #### Path Parameters - **format** (u32) - Required - GL pixel format (e.g., RED, RGB, RGBA) ### Returns `usize` — Number of components in the format ``` -------------------------------- ### Create Transform Feedback Object Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Creates a new transform feedback object. Use this to capture vertex shader output. ```rust pub unsafe fn create_transform_feedback(&self) -> Result ``` ```rust unsafe { let tf = gl.create_transform_feedback() .expect("Failed to create transform feedback"); gl.bind_transform_feedback(glow::TRANSFORM_FEEDBACK, Some(tf)); } ``` -------------------------------- ### Resume Transform Feedback Recording Source: https://github.com/grovesnl/glow/blob/main/_autodocs/advanced-features.md Resumes a previously paused transform feedback recording session. ```rust pub unsafe fn resume_transform_feedback(&self) ``` -------------------------------- ### Buffers & Data Source: https://github.com/grovesnl/glow/blob/main/_autodocs/INDEX.md Functions for creating, uploading data to, and binding GPU buffers, as well as performing GPU-side buffer copying. ```APIDOC ## Buffers & Data ### Description Functions for creating, uploading data to, and binding GPU buffers, as well as performing GPU-side buffer copying. ### Methods - `create_buffer()` - `buffer_data_u8_slice()` - `bind_buffer()` - `bind_buffer_base()` - `copy_buffer_sub_data()` ``` -------------------------------- ### Create a new buffer Source: https://github.com/grovesnl/glow/blob/main/_autodocs/buffers-and-vertex-arrays.md Creates a new buffer object. The buffer must be bound and configured before use. ```rust pub unsafe fn create_buffer(&self) -> Result ``` ```rust unsafe { let vertex_buffer = gl.create_buffer() .expect("Failed to create buffer"); gl.bind_buffer(glow::ARRAY_BUFFER, Some(vertex_buffer)); } ``` -------------------------------- ### link_program Source: https://github.com/grovesnl/glow/blob/main/_autodocs/shader-and-programs.md Links the program. Check `get_program_link_status` to verify success. ```APIDOC ## link_program ### Description Links the program. Check `get_program_link_status` to verify success. ### Method `link_program` ### Parameters #### Path Parameters - **program** (Program) - Required - The program to link. ### Example ```rust unsafe { gl.link_program(program); let linked = gl.get_program_link_status(program); if !linked { let log = gl.get_program_info_log(program); eprintln!("Link failed: {}", log); } } ``` ``` -------------------------------- ### Version Checking for OpenGL Features Source: https://github.com/grovesnl/glow/blob/main/_autodocs/quick-reference.md Check the OpenGL version before using features that are version-specific. This allows for graceful degradation or alternative implementations on older hardware. ```rust let version = gl.version(); if version.major >= 4 && version.minor >= 5 { // GL 4.5+ code } else if version.major >= 4 { // GL 4.0-4.4 code } ```