#include
#include
GLint sideLen=300;
GLubyte star[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 32 31
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x60, // 30 29
0x03,0xC0,0x01,0xE0,0x01,0x30,0x06,0x40, // 28 27
0x01,0x8F,0x78,0xC0,0x00,0x81,0xC0,0x80, // 26 25
0x00,0xC0,0x81,0x80,0x00,0x40,0x01,0x00, // 24 23
0x00,0x40,0x01,0x00,0x00,0x60,0x03,0x00, // 22 21
0x00,0x60,0x03,0x00,0x00,0xE0,0x03,0x80, // 20 19
0x00,0xC0,0x01,0x80,0x01,0x80,0x00,0xC0, // 18 17
0x06,0x00,0x00,0x30,0x08,0x00,0x00,0x08, // 16 15
0x10,0x00,0x00,0x04,0x3F,0xF8,0x0F,0xFE, // 14 13
0x00,0x0C,0x18,0x00,0x00,0x04,0x10,0x00, // 12 11
0x00,0x06,0x30,0x00,0x00,0x02,0x20,0x00, // 10 9
0x00,0x01,0x40,0x00,0x00,0x01,0x40,0x00, // 8 7
0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00, // 6 5
0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00, // 4 3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // 2 1
};
void display()
{
glClearColor(1,1,1,1);
glColor3f(1,0,0);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0,0,sideLen,sideLen);
glRectf(-0.8,-0.8,0.8,0.8);
glViewport(sideLen,0,sideLen,sideLen);
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple(star);
glColor3f(1,0,0);
glRectf(-0.8,-0.8,0.8,0.8);
glDisable(GL_POLYGON_STIPPLE);
glFlush();
}
int main()
{
glutInitWindowSize(sideLen*2,sideLen);
glutCreateWindow("2 Squares");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}