5 releases

0.1.4 Aug 2, 2020
0.1.3 Aug 1, 2020
0.1.2 Aug 1, 2020
0.1.1 Aug 1, 2020
0.1.0 Aug 1, 2020

#571 in Graphics APIs

Download history 72/week @ 2023-12-17 57/week @ 2023-12-24 42/week @ 2023-12-31 78/week @ 2024-01-07 64/week @ 2024-01-14 64/week @ 2024-01-21 39/week @ 2024-01-28 51/week @ 2024-02-04 77/week @ 2024-02-11 85/week @ 2024-02-18 79/week @ 2024-02-25 75/week @ 2024-03-03 102/week @ 2024-03-10 103/week @ 2024-03-17 87/week @ 2024-03-24 249/week @ 2024-03-31

557 downloads per month
Used in 6 crates (3 directly)

MIT license

760KB
19K SLoC

glu-sys

Raw GLU and GL Rust bindings

This crate doesn't handle windowing, it can be used with other crates which handle windowing and gl contexts to do raw opengl calls.

fn draw_triangle() {
    use glu_sys::*;
    unsafe {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glViewport(0, 0, W, H);
        gluPerspective(45.0, (W as f32 / H as f32).into(), 1.0, 10.0);
        glTranslatef(0.0, 0.0, -5.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glRotatef(0.0, 1.0, 1.0, 0.0);
        glColor3f(1.0, 0.0, 0.0);
        glBegin(GL_POLYGON);
        glVertex3f(0.0, 1.0, 0.0);
        glVertex3f(1.0, -1.0, 1.0);
        glVertex3f(-1.0, -1.0, 1.0);
        glEnd();
        glColor3f(0.0, 1.0, 0.0);
        glBegin(GL_POLYGON);
        glVertex3f(0.0, 1.0, 0.0);
        glVertex3f(0.0, -1.0, -1.0);
        glVertex3f(1.0, -1.0, 1.0);
        glEnd();
        glColor3f(0.0, 0.0, 1.0);
        glBegin(GL_POLYGON);
        glVertex3f(0.0, 1.0, 0.0);
        glVertex3f(-1.0, -1.0, 1.0);
        glVertex3f(0.0, -1.0, -1.0);
        glEnd();
        glColor3f(1.0, 0.0, 0.0);
        glBegin(GL_POLYGON);
        glVertex3f(1.0, -1.0, 1.0);
        glVertex3f(0.0, -1.0, -1.0);
        glVertex3f(-1.0, -1.0, 1.0);
        glEnd();
        glLoadIdentity();
        glRasterPos2f(-3.0, -2.0);
    }
}

Full example using the fltk crate here.

Dependencies