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
use gl; use gl::types::*; use std::ptr; use super::enums::*; /// Specify clear values for the color buffers /// /// # Examples /// ``` /// gl_clear_color(0.5, 0.5, 0.2, 1.0); /// ``` /// /// More: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glClearColor.xhtml pub fn gl_clear_color(red: GLfloat, green: GLfloat, blue: GLfloat, aplha: GLfloat) { unsafe { gl::ClearColor(red, green, blue, aplha); } } /* pub fn gl_clear(mask: GLClearMask) { unsafe { gl::Clear(mask as GLenum); } } */ /// Render primitives from array data /// /// # Examples /// ``` /// gl_bind_buffer(GLTarget::ArrayBuffer, vbo); /// gl_draw_arrays(GLPrimitive::Triangles, 0, 3); /// ``` /// /// More: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawArrays.xhtml pub fn gl_draw_arrays(primitive: GLPrimitive, first: GLint, count: GLsizei) { unsafe { gl::DrawArrays(primitive as u32, first, count); } } /// Render primitives from array data /// /// # Examples /// ``` /// gl_bind_vertex_array(GLTarget::ArrayBuffer, vao); /// gl_draw_elements(GLPrimitive::Triangles, 36, GLType::UInt); /// ``` /// /// More: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawArrays.xhtml /// TODO: ptr thing pub fn gl_draw_elements(primitive: GLPrimitive, count: GLsizei, type_: GLType) { unsafe { gl::DrawElements(primitive as GLenum, count, type_ as GLenum, ptr::null()); } } /// Draw multiple instances of a set of elements /// /// # Examples /// ``` /// gl_bind_vertex_array(GLTarget::ArrayBuffer, vao); /// gl_draw_elements_instanced(GLPrimitive::Triangles, 36, GLType::UInt, 8); /// ``` /// /// More: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawElementsInstanced.xhtml /// TODO: Ptr thing pub fn gl_draw_elements_instanced( primitive: GLPrimitive, count: GLsizei, type_: GLType, prim_count: GLsizei, ) { unsafe { gl::DrawElementsInstanced( primitive as GLenum, count, type_ as GLenum, ptr::null(), prim_count, ); } } /// render primitives from array data /// /// More: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawRangeElements.xhtml pub fn gl_draw_range_elements(mode: GLPrimitive, start: GLuint, end: GLuint, count: GLsizei, type_: GLType) { unsafe { gl::DrawRangeElements(mode as GLenum, start, end, count, type_ as GLenum, ptr::null()); } }