Skip to main content

glu_sys/
lib.rs

1//! # glu-sys
2//! Raw GLU and GL Rust bindings
3
4//! This crate doesn't handle windowing, it can be used with other crates which handle windowing and gl contexts to do raw opengl calls.
5
6//! ```rust
7//! fn draw_triangle() {
8//!     use glu_sys::*;
9//!     unsafe {
10//!         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
11//!         glMatrixMode(GL_PROJECTION);
12//!         glLoadIdentity();
13//!         glViewport(0, 0, W, H);
14//!         gluPerspective(45.0, (W as f32 / H as f32).into(), 1.0, 10.0);
15//!         glTranslatef(0.0, 0.0, -5.0);
16//!         glMatrixMode(GL_MODELVIEW);
17//!         glLoadIdentity();
18//!         glRotatef(0.0, 1.0, 1.0, 0.0);
19//!         glColor3f(1.0, 0.0, 0.0);
20//!         glBegin(GL_POLYGON);
21//!         glVertex3f(0.0, 1.0, 0.0);
22//!         glVertex3f(1.0, -1.0, 1.0);
23//!         glVertex3f(-1.0, -1.0, 1.0);
24//!         glEnd();
25//!         glColor3f(0.0, 1.0, 0.0);
26//!         glBegin(GL_POLYGON);
27//!         glVertex3f(0.0, 1.0, 0.0);
28//!         glVertex3f(0.0, -1.0, -1.0);
29//!         glVertex3f(1.0, -1.0, 1.0);
30//!         glEnd();
31//!         glColor3f(0.0, 0.0, 1.0);
32//!         glBegin(GL_POLYGON);
33//!         glVertex3f(0.0, 1.0, 0.0);
34//!         glVertex3f(-1.0, -1.0, 1.0);
35//!         glVertex3f(0.0, -1.0, -1.0);
36//!         glEnd();
37//!         glColor3f(1.0, 0.0, 0.0);
38//!         glBegin(GL_POLYGON);
39//!         glVertex3f(1.0, -1.0, 1.0);
40//!         glVertex3f(0.0, -1.0, -1.0);
41//!         glVertex3f(-1.0, -1.0, 1.0);
42//!         glEnd();
43//!         glLoadIdentity();
44//!         glRasterPos2f(-3.0, -2.0);
45//!     }
46//! }
47//! ```
48
49//! Full example using the fltk crate [here](https://github.com/MoAlyousef/fltk-rs-demos/blob/master/opengl/src/main.rs).
50
51#![no_std]
52#![allow(non_camel_case_types)]
53#![allow(dead_code)]
54#![allow(non_upper_case_globals)]
55
56pub mod glu;
57
58pub use glu::*;