harbor run -t openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-7901harbor download openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-7901Implement an OpenGL display handling module in Rust located in the /app/ directory. This module should provide a safe and efficient interface for managing OpenGL displays and rendering operations, compatible with the glium crate.
Display Initialization:
build_display function that sets up and returns an OpenGL display context using glium. Ensure proper error handling and initialization.OpenGL Version Retrieval:
get_opengl_version that returns the version of OpenGL in use by the current display context. This should return a tuple containing the major and minor version numbers.Surface Operations:
clear_color that accepts four parameters (RGBA) and clears the entire surface to the specified color.clear that allows clearing a specific rectangle on the surface with a specified color. This method should take parameters for the rectangle dimensions and the color to clear with.read to retrieve pixel data from the cleared surface as a 2D vector of pixels (in RGBA format).Shader Compiler Management:
release_shader_compiler method to release resources associated with the shader compiler without triggering OpenGL errors.Timestamp Query:
TimestampQuery::new. Implement a method to compare two timestamps to ensure that the second is always greater than or equal to the first.Synchronization:
SyncFence::new to create a synchronization object that can wait until rendering is complete.Multiple Displays:
Debugging:
insert_debug_marker which logs a debug message in the OpenGL context.is_context_lost that checks if the OpenGL context is lost, ensuring it does not trigger errors.Ensure all functions are compatible with glium and respect error handling practices. Once implemented, run the provided tests to confirm correctness.