MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / gears_draw

Function gears_draw

test/full_es2_sdlproc.c:516–540  ·  view source on GitHub ↗

* Draws the gears. */

Source from the content-addressed store, hash-verified

514 * Draws the gears.
515 */
516static void
517gears_draw(void)
518{
519 const static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
520 const static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
521 const static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
522 GLfloat transform[16];
523 identity(transform);
524
525 glClearColor(0.0, 0.0, 0.0, 0.0);
526 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
527
528 /* Translate and rotate the view */
529 translate(transform, 0, 0, -20);
530 rotate(transform, 2 * M_PI * view_rot[0] / 360.0, 1, 0, 0);
531 rotate(transform, 2 * M_PI * view_rot[1] / 360.0, 0, 1, 0);
532 rotate(transform, 2 * M_PI * view_rot[2] / 360.0, 0, 0, 1);
533
534 /* Draw the gears */
535 draw_gear(gear1, transform, -3.0, -2.0, angle, red);
536 draw_gear(gear2, transform, 3.1, -2.0, -2 * angle - 9.0, green);
537 draw_gear(gear3, transform, -3.1, 4.2, -2 * angle - 25.0, blue);
538
539 glutSwapBuffers();
540}
541
542/**
543 * Handles a new window size or exposure.

Callers 1

mainFunction · 0.70

Calls 4

identityFunction · 0.70
translateFunction · 0.70
rotateFunction · 0.70
draw_gearFunction · 0.70

Tested by

no test coverage detected