Example #1
0
void do_display (void)
{
    int i,j,s,t, tmp;
    cum_al = 0.0;

    metaal_texture();

    for (s=0;s<24;s += 2)
    {
	t = s+2;
	if (!(t&7))
	    t=t-8;

	if (s == 16)
	    rood_texture();
	glBegin(GL_QUADS);
	for (i=0;i<tot;i=j)
	{
	    tmp = 0;
	    for (j=i+1;j<tot;j++)
		if ((tmp=tmp+tmp+opt[j]) > 4000 || (!(j%(3*DIST))))
		    break;

	    if (j>=tot)
		j = 0;

	    rr++;
	    VERTEX(s, j);
	    VERTEX(s, i);
	    VERTEX(t, i);
	    VERTEX(t, j);
	    if (!j)
		break;
	}
	glEnd();
    }
    printf("Split up to %d parts.\n", rr);
    rood_texture();
    for (i=0;i<tot-2;i+=DIST)
    {
	if (!(i%(DIST*5)))
	    continue;

	glBegin(GL_QUADS);
	glNormal3fv(bnormal[0][i]);
	glVertex3fv(strips[24][i]);
	glVertex3fv(strips[24][i+5]);
	glVertex3fv(strips[26][i+5]);
	glVertex3fv(strips[26][i]);

	glNormal3fv(bnormal[1][i]);
	glVertex3fv(strips[25][i]);
	glVertex3fv(strips[25][i+5]);
	glVertex3fv(strips[26][i+5]);
	glVertex3fv(strips[26][i]);
	glEnd();
    }

    wit_texture();
    for (i=0;i<tot-2;i+=DIST)
    {
	if (i%(DIST*5))
	    continue;

	glBegin(GL_QUADS);
	glNormal3fv(bnormal[0][i]);
	glVertex3fv(strips[24][i]);
	glVertex3fv(strips[24][i+5]);
	glVertex3fv(strips[26][i+5]);
	glVertex3fv(strips[26][i]);

	glNormal3fv(bnormal[1][i]);
	glVertex3fv(strips[25][i]);
	glVertex3fv(strips[25][i+5]);
	glVertex3fv(strips[26][i+5]);
	glVertex3fv(strips[26][i]);
	glEnd();
    }

    groen_texture();
    glBegin(GL_QUADS);
    for (i=0;i<tot;i+=90)
    {
	if (dy[i]<0.2)
	    continue;
	glNormal3f(-1.0, 0.0, 0.0);
	glVertex3f(strips[22][i][0]-0.7,-4,strips[22][i][2]-0.7);
	glVertex3f(strips[22][i][0]-0.2,strips[16][i][1],strips[22][i][2]-0.2);
	glVertex3f(strips[22][i][0]-0.2,strips[16][i][1],strips[22][i][2]+0.2);
	glVertex3f(strips[22][i][0]-0.7,-4,strips[22][i][2]+0.7);

	glNormal3f(0.0, 0.0, 1.0);
	glVertex3f(strips[22][i][0]+0.7,-4,strips[22][i][2]+0.7);
	glVertex3f(strips[22][i][0]+0.2,strips[16][i][1],strips[22][i][2]+0.2);
	glVertex3f(strips[22][i][0]-0.2,strips[16][i][1],strips[22][i][2]+0.2);
	glVertex3f(strips[22][i][0]-0.7,-4,strips[22][i][2]+0.7);

	glNormal3f(0.0, 0.0, -1.0);
	glVertex3f(strips[22][i][0]+0.7,-4,strips[22][i][2]-0.7);
	glVertex3f(strips[22][i][0]+0.2,strips[16][i][1],strips[22][i][2]-0.2);
	glVertex3f(strips[22][i][0]-0.2,strips[16][i][1],strips[22][i][2]-0.2);
	glVertex3f(strips[22][i][0]-0.7,-4,strips[22][i][2]-0.7);

	glNormal3f(1.0, 0.0, 0.0);
	glVertex3f(strips[22][i][0]+0.7,-4,strips[22][i][2]-0.7);
	glVertex3f(strips[22][i][0]+0.2,strips[16][i][1],strips[22][i][2]-0.2);
	glVertex3f(strips[22][i][0]+0.2,strips[16][i][1],strips[22][i][2]+0.2);
	glVertex3f(strips[22][i][0]+0.7,-4,strips[22][i][2]+0.7);
    }
    glEnd();
}
Example #2
0
void display(void)
{
    int plaatje2, l;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();
    glCallList(1);

    glPopMatrix();
    glPushMatrix();

    glEnable(GL_TEXTURE_2D);
    glTexImage2D(GL_TEXTURE_2D, 0, 3, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE,
	&texture[0][0][0]);

    glBegin(GL_QUADS);
    glNormal3f(0.0, 1.0, 0.0);
    glTexCoord2f(0.0, 0.0); glVertex3f(-120, -4.1, -120);
    glTexCoord2f(0.0, 1.0); glVertex3f(-120, -4.1, 120);
    glTexCoord2f(1.0, 1.0); glVertex3f(120, -4.1, 120);
    glTexCoord2f(1.0, 0.0); glVertex3f(120, -4.1, -120);
    glEnd();
    glDisable(GL_TEXTURE_2D);

/* The sky moves with us to give a perception of being infinitely far away */

    groen_texture();
    l = plaatje;
    glBegin(GL_QUADS);
    glNormal3f(0.0, 1.0, 0.0);
    glTexCoord2f(0.0, 0.0);
    glVertex3f(-400+x[l], 21+y[l], -400+z[l]);
    glTexCoord2f(0.0, 1.0);
    glVertex3f(-400+x[l], 21+y[l], 400+z[l]);
    glTexCoord2f(1.0, 1.0);
    glVertex3f(400+x[l], 21+y[l], 400+z[l]);
    glTexCoord2f(1.0, 0.0);
    glVertex3f(400+x[l], 21+y[l], -400+z[l]);
    glEnd();

    display_cart(plaatje);

    plaatje2 = plaatje + 40;
    if (plaatje2 >= tot)
	plaatje2 -= tot;
    display_cart(plaatje2);

    plaatje2 = plaatje + 20;
    if (plaatje2 >= tot)
	plaatje2 -= tot;
    display_cart(plaatje2);

    plaatje2 = plaatje - 20;
    if (plaatje2 < 0)
	plaatje2 += tot;
    display_wheel(plaatje2);

    glFlush();
    glutSwapBuffers();
    glPopMatrix();
}
Example #3
0
void draw_logo(void)
{
    float left_start = -20.0;
    float f_width = 7.2;
    float l_width = 4.3;
    float a_width = 6.6;
    float t_width = 3.7;
    float n_width = 6.6;
    float d_width = 6.6;
    float position;
    char flatland[] = "flatland";
    int i; 
    char tmp;

    
#ifdef TYPEO
	if( swap_position>=0 && swap_position<8 )
	{ 
	    tmp = flatland[swap_position];
	    flatland[swap_position] = flatland[swap_position+1];
	    flatland[swap_position+1] = tmp;
    	}
#endif
	        
	glEnable(GL_CULL_FACE);

    	glPushMatrix( );
	
    	glTranslatef(1.0, -5.0, 0.0);

    	glPushMatrix( );
        glRotatef(15.0, 1.0, 0.0, 0.0);
	draw_part(0);
    	glPopMatrix( );
    	
    	groen_texture();

    	position = left_start;

    	for( i=0; i<8; i++ )
	{
    	    switch( flatland[i] )
	    {
	    case 'f':
    		// width of F = 7.2
    		glPushMatrix( );
		glTranslatef( position, 4.3, 5.0);
	//	glTranslatef(-20.0, 4.3, 5.0);
		draw_part(1);
    		glPopMatrix( );
    		position += f_width;
    	    	break;

    	    case 'l':
		//width of l = 4.3
    		glPushMatrix( );
		glTranslatef( position, 4.3, 5.0);
	//	glTranslatef(-12.8, 4.3, 5.0);
	//	glTranslatef(7.2, 0.0, 0.0);
		draw_part(2);
    		glPopMatrix( );
    		position += l_width;
    	    	break;
		
	    case 'a':
    		// width of a = 4.7
    		glPushMatrix( );
		glTranslatef( position, 4.3, 5.0);
	//	glTranslatef( left_start, 4.3, 5.0);
	//	glTranslatef(-8.5, 4.3, 5.0);
	//	glTranslatef(4.3, 0.0, 0.0);
		draw_part(3);
    		glPopMatrix( );
    		position += a_width;
    	    	break;
		
	    case 't':
    		// width of t = 3.7
    		glPushMatrix( );
		glTranslatef( position, 4.3, 5.0);
	//	glTranslatef(-3.8, 4.3, 5.0);
	//	glTranslatef(4.7, 0.0, 0.0);
		draw_part(4);
    		glPopMatrix( );
    		position += t_width;
    	    	break;
		
//    		// width of l = 4.3
//    		glPushMatrix( );
//		glTranslatef( position, 4.3, 5.0);
//	//	glTranslatef(-0.1, 4.3, 5.0);
//	//	glTranslatef(3.7, 0.0, 0.0);
//		draw_part(5);
//    		glPopMatrix( );
//    		position += l_width;
//    	    	
//    		// width of a = 6.6
//    		glPushMatrix( );
//		glTranslatef( position, 4.3, 5.0);
//	//	glTranslatef(4.2, 4.3, 5.0);
//	//	glTranslatef(4.3, 0.0, 0.0);
//		draw_part(6);
//    		glPopMatrix( );
//    		position += a_width;
    	    	
	    case 'n':
    		// width of n = 6.6
    		glPushMatrix( );
		glTranslatef( position, 4.3, 5.0);
	//	glTranslatef(10.8, 4.3, 5.0);
	//	glTranslatef(6.6, 0.0, 0.0);
		draw_part(7);
    		glPopMatrix( );
    		position += n_width;
    	    	break;
		
	    case 'd':
    		// width of d = 6.6
    		glPushMatrix( );
		glTranslatef( position, 4.3, 5.0);
	//	glTranslatef(17.4, 4.3, 5.0);
	//        glTranslatef(6.8, 0.0, 0.0);
        	draw_part(8);
    		glPopMatrix( );
    		position += d_width;
		break;
		
	    default:
	    	break;
	    }
    	}
    	glPopMatrix( );
}