スポンサーリンク
[package]
name = "winittest"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
glfw = "0.51.0"
gl="0.14.0"
use glfw::{Action, Context, Key, ffi::glfwTerminate}; fn main() { let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap(); //////////////////////////////////////////////// //////////////////////////////////////////////// let (mut window, events) = glfw.create_window(300, 300, "Hello this is window", glfw::WindowMode::Windowed) .expect("Failed to create GLFW window."); window.make_current(); //////////////////////////////////////////////// //////////////////////////////////////////////// gl::load_with(|s| glfw.get_proc_address_raw(s)); gl::Viewport::load_with(|s| glfw.get_proc_address_raw(s)); //////////////////////////////////////////////// //////////////////////////////////////////////// while window.should_close() == false{ let (width,height)=window.get_framebuffer_size(); unsafe{ gl::Viewport(0,0,width,height); gl::ClearColor(0.5,0.5,0.5,1.0); gl::Clear(gl::COLOR_BUFFER_BIT); } window.swap_buffers(); glfw.wait_events(); } }
なお、
と聞かれた場合、Rustが中でcmake.exeを読んでいるので、cmake.exeへのパスを通しておく必要がある。