1#![allow(non_snake_case)]
2
3use core::ffi::{c_void, CStr};
4use crate::utils::*;
5
6pub use crate::types::*;
7pub use enums::*;
8
9mod enums;
10
11static mut CHOOSE_PIXEL_FORMAT_ARB_PTR: *const c_void = core::ptr::null();
12static mut CREATE_CONTEXT_ATTRIBS_ARB_PTR: *const c_void = core::ptr::null();
13static mut SWAP_INTERVAL_EXT_PTR: *const c_void = core::ptr::null();
14
15
16pub unsafe fn wglChoosePixelFormatARB(hdc: *mut c_void, piAttribIList: *const GLint, pfAttribFList: *const f32, nMaxFormats: GLuint, piFormats: *mut GLint, nNumFormats: *mut GLuint) -> bool {
17 call_ptr_6arg(CHOOSE_PIXEL_FORMAT_ARB_PTR, hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats)
18}
19
20pub unsafe fn wglCreateContextAttribsARB(hdc: *mut c_void, hShareContext: *mut c_void, attribList: *const GLint) -> *mut c_void {
21 call_ptr_3arg(CREATE_CONTEXT_ATTRIBS_ARB_PTR, hdc, hShareContext, attribList)
22}
23
24pub unsafe fn wglSwapIntervalEXT(interval: GLint) -> bool {
26 call_ptr_1arg(SWAP_INTERVAL_EXT_PTR, interval)
27}
28
29pub unsafe fn load(get_proc_address: impl Fn(&CStr)-> *const c_void) {
30 CHOOSE_PIXEL_FORMAT_ARB_PTR = get_proc_address(c"wglChoosePixelFormatARB");
31 CREATE_CONTEXT_ATTRIBS_ARB_PTR = get_proc_address(c"wglCreateContextAttribsARB");
32 SWAP_INTERVAL_EXT_PTR = get_proc_address(c"wglSwapIntervalEXT");
33}