1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#![crate_name="osmesa_sys"]
#![crate_type="lib"]
extern crate gl;
extern crate libc;
use gl::types::{
GLboolean,
GLenum,
GLint,
GLsizei,
};
use libc::{
c_char,
c_void,
};
#[link(name="OSMesa")]
extern "C" {
pub fn OSMesaColorClamp (enable: GLboolean);
pub fn OSMesaCreateContext (format: GLenum, sharelist: OSMesaContext) -> OSMesaContext;
pub fn OSMesaCreateContextExt (format: GLenum, depthBits: GLint, stencilBits: GLint, accumBits: GLint, sharelist: OSMesaContext) -> OSMesaContext;
pub fn OSMesaDestroyContext (ctx: OSMesaContext);
pub fn OSMesaGetColorBuffer (c: OSMesaContext, width: *mut GLint, height: *mut GLint, format: *mut GLint, buffer: *mut *mut c_void) -> GLboolean;
pub fn OSMesaGetCurrentContext () -> OSMesaContext;
pub fn OSMesaGetDepthBuffer (c: OSMesaContext, width: *mut GLint, height: *mut GLint, bytesPerValue: *mut GLint, buffer: *mut *mut c_void) -> GLboolean;
pub fn OSMesaGetIntegerv (pname: GLint, value: *mut GLint);
pub fn OSMesaGetProcAddress (funcName: *const c_char) -> OSMESAproc;
pub fn OSMesaMakeCurrent (ctx: OSMesaContext, buffer: *mut c_void, _type: GLenum, width: GLsizei, height: GLsizei) -> GLboolean;
pub fn OSMesaPixelStore (pname: GLint, value: GLint);
}
#[repr(C)] pub struct osmesa_context;
pub type OSMesaContext = *mut osmesa_context;
pub type OSMESAproc = Option<unsafe extern "C" fn ()>;
pub const OSMESA_COLOR_INDEX: GLenum = 0x1900;
pub const OSMESA_RGBA: GLenum = gl::RGBA;
pub const OSMESA_BGRA: GLenum = 0x0001;
pub const OSMESA_ARGB: GLenum = 0x0002;
pub const OSMESA_RGB: GLenum = gl::RGB;
pub const OSMESA_BGR: GLenum = 0x0004;
pub const OSMESA_RGB_565: GLenum = 0x0005;
pub const OSMESA_WIDTH: GLint = 0x0020;
pub const OSMESA_HEIGHT: GLint = 0x0021;
pub const OSMESA_FORMAT: GLint = 0x0022;
pub const OSMESA_TYPE: GLint = 0x0023;
pub const OSMESA_MAX_WIDTH: GLint = 0x0024;
pub const OSMESA_MAX_HEIGHT: GLint = 0x0025;
pub const OSMESA_ROW_LENGTH: GLint = 0x0010;
pub const OSMESA_Y_UP: GLint = 0x0011;