Posts
Simple wire framed figure with motion (demo use of Stencil)
Description:
The main intent of this program is to demo the stencil plane functionality, hence the rendering is kept simple (wire frame). Usese:
Right click to choose the motion and the Stencil on/off. The Project Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
static int stencilOn = 1; /* function declarations */
void drawScene(void), setMatrix(void), animation(void), resize(int w, int h),
keyboard(unsigned char c, int x, int y), menu(int choice), drawWireframe(int face),
drawFilled(int face); /* global variables */
float ax, ay, az; /* angles for animation */ /* coords of a cube */
static GLfloat cube[8][3] =
{0.0, 0.0, 0.0,
1.0, 0.0, 0.0,
1.0, 0.0, 1.0,
0.0, 0.0, 1.0,
1.0, 1.0, 0.0,
1.0, 1.0, 1.0,
0.0, 1.0, 1.0,
0.0, 1.0, 0.0};
static int faceIndex[6][4] =
{0, 1, 2, 3,
1, 4, 5, 2,
4, 7, 6, 5,
7, 0, 3, 6,
3, 2, 5, 6,
7, 4, 1, 0};
int main(int argc, char **argv)
{
glutInit(&argc, argv); …