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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
use crate::graphics::{
GLCore,
core::GLError,
core::drawing::{
PrimitiveType,
IndexType,
AvailableIndexType,
},
};
pub struct Drawing;
impl Drawing{
/// Renders primitives from array data.
///
/// `GLError::InvalidValue` is generated if `count` is negative.
///
/// `GLError::InvalidOperation` is generated
/// if a non-zero buffer object name is bound to an enabled array
/// and the buffer object's data store is currently mapped,
/// or if a geometry shader is active and mode is incompatible
/// with the input primitive type of the geometry shader in the currently installed program object.
pub fn draw_arrays(start:i32,count:i32,mode:PrimitiveType)->GLError{
unsafe{
GLCore.drawing.draw_arrays(start,count,mode);
GLCore.get_error()
}
}
/// Render primitives from array data.
///
/// `GLError::InvalidValue` is generated if `count` is negative.
///
/// `GLError::InvalidOperation` is generated
/// if a non-zero buffer object name is bound to an enabled array or the element array
/// and the buffer object's data store is currently mapped,
/// or if a geometry shader is active and mode is incompatible
/// with the input primitive type of the geometry shader in the currently installed program object.
pub fn draw_elements(start:i32,count:i32,index_type:IndexType,mode:PrimitiveType)->GLError{
unsafe{
GLCore.drawing.draw_elements(start,count,index_type,mode);
GLCore.get_error()
}
}
/// Renders primitives from array dat
///
/// `GLError::InvalidValue` is generated if `count` is negative.
///
/// `GLError::InvalidOperation` is generated
/// if a non-zero buffer object name is bound to an enabled array or the element array
/// and the buffer object's data store is currently mapped,
/// or if a geometry shader is active and mode is incompatible
/// with the input primitive type of the geometry shader in the currently installed program object.
pub fn draw_elements_typed<T:AvailableIndexType>(start:i32,count:i32,mode:PrimitiveType)->GLError{
unsafe{
GLCore.drawing.draw_elements_typed::<T>(start,count,mode);
GLCore.get_error()
}
}
/// Renders multiple sets of primitives from array data.
///
/// `GLError::InvalidOperation` is generated
/// if a non-zero buffer object name is bound to an enabled array
/// and the buffer object's data store is currently mapped.
pub fn multi_draw_arrays(&self,start:&[i32],count:&[i32],mode:PrimitiveType)->GLError{
unsafe{
GLCore.drawing.multi_draw_arrays(start,count,mode);
GLCore.get_error()
}
}
/// Renders multiple sets of primitives by specifying indices of array data elements.
///
/// `GLError::InvalidOperation` is generated
/// if a non-zero buffer object name is bound to an enabled array or the element array
/// and the buffer object's data store is currently mapped.
pub fn multi_draw_elements(
&self,
start:&[isize],
count:&[i32],
index_type:IndexType,
mode:PrimitiveType
)->GLError{
unsafe{
GLCore.drawing.multi_draw_elements(start,count,index_type,mode);
GLCore.get_error()
}
}
/// Renders multiple sets of primitives by specifying indices of array data elements.
///
/// `GLError::InvalidOperation` is generated
/// if a non-zero buffer object name is bound to an enabled array or the element array
/// and the buffer object's data store is currently mapped.
pub fn multi_draw_elements_typed<T:AvailableIndexType>(
&self,
start:&[isize],
count:&[i32],
mode:PrimitiveType
)->GLError{
unsafe{
GLCore.drawing.multi_draw_elements_typed::<T>(start,count,mode);
GLCore.get_error()
}
}
}