From 93217e1a6668e03a72e74a833503a478688ea9a3 Mon Sep 17 00:00:00 2001 From: Melik Houij Date: Sun, 5 Mar 2023 00:49:10 +0100 Subject: [PATCH] new commit for Porting to Glow --- Cargo.toml | 1 + src/main.rs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 19ddc96..d84d453 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,5 +11,6 @@ image = "0.24.5" gl = "0.14.0" cgmath = "0.18.0" tobj = "2.0.0" +glow = "0.12.1" [dependencies.glfw] version = "*" diff --git a/src/main.rs b/src/main.rs index 5e1e603..8c5f8f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,6 +7,7 @@ const SCR_WIDTH: u32 = 1600; const SCR_HEIGHT: u32 = 900; const TITLE: &str = "GLFWtest"; +use glow; use std::sync::mpsc::Receiver; use std::ptr; @@ -54,7 +55,9 @@ fn main() { let mut deltaTime: f32; // time between current frame and last frame let mut lastFrame: f32 = 0.0; - gl::load_with(|ptr| window.get_proc_address(ptr) as *const _); + //gl::load_with(|ptr| window.get_proc_address(ptr) as *const _); + let gl = unsafe{glow::Context::from_loader_function(|s| window.get_proc_address(s) as *const _);}; + let (ourshader, ourModel) = unsafe { gl::Enable(gl::DEPTH_TEST); @@ -81,8 +84,7 @@ fn main() { unsafe { gl::Enable(gl::DEPTH_TEST); - gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT | gl::STENCIL_BUFFER_BIT); - gl::ClearColor(0.0, 0.0, 0.0, 0.0); + gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT); // outline