Exemple #1
0
void goal_init(int b)
{
    int i, n = b ? 32 : 8;

    goal_list = glGenLists(1);

    glNewList(goal_list, GL_COMPILE);
    {
        #ifdef __PSP__
        glBegin(GL_TRIANGLE_STRIP);
        #else
        glBegin(GL_QUAD_STRIP);
        #endif
        {
            for (i = 0; i <= n; i++)
            {
                float x, y;
                fsincosf(2.f * PI * i / n, &x, &y);
               
                glColor4f(1.0f, 1.0f, 0.0f, 0.5f);
                glVertex3f(x, 0.0f, y);

                glColor4f(1.0f, 1.0f, 0.0f, 0.0f);
                glVertex3f(x, GOAL_HEIGHT, y);
            }
        }
        glEnd();
    }
    glEndList();
}
Exemple #2
0
void swch_init(int b)
{
    int k, i, n = b ? 32 : 8;

    swch_list = glGenLists(4);

    /* Create the display lists. */

    for (k = 0; k < 4; k++)
    {
        glNewList(swch_list + k, GL_COMPILE);
        {
            #ifdef __PSP__
            glBegin(GL_TRIANGLE_STRIP);
            #else
            glBegin(GL_QUAD_STRIP);
            #endif
            {
                for (i = 0; i <= n; i++)
                {
                    float x, y;
                    fsincosf(2.f * PI * i / n, &x, &y);

                    glColor4fv(swch_colors[2 * k + 0]);
                    glVertex3f(x, 0.0f, y);

                    glColor4fv(swch_colors[2 * k + 1]);
                    glVertex3f(x, SWCH_HEIGHT, y);
                }
            }
            glEnd();
        }
        glEndList();
    }
}
Exemple #3
0
void jump_init(int b)
{
    int k, i, n = b ? 32 : 8;

    jump_list = glGenLists(2);

    for (k = 0; k < 2; k++)
    {
        glNewList(jump_list + k, GL_COMPILE);
        {
            #ifdef __PSP__
            glBegin(GL_TRIANGLE_STRIP);
            #else
            glBegin(GL_QUAD_STRIP);
            #endif
            {
                for (i = 0; i <= n; i++)
                {
                    float x, y;
                    fsincosf(2.f * PI * i / n, &x, &y);
                    
                    glColor4f(0.75f, 0.5f, 1.0f, (k == 0 ? 0.5f : 0.8f));
                    glVertex3f(x, 0.0f, y);

                    glColor4f(1.0f, 1.0f, 1.0f, 0.0f);
                    glVertex3f(x, JUMP_HEIGHT, y);
                }
            }
            glEnd();
        }
        glEndList();
    }
}
Exemple #4
0
void flag_init(int b)
{
    int i, n = b ? 8 : 4;

    flag_list = glGenLists(1);

    glNewList(flag_list, GL_COMPILE);
    {
        //glEnable(GL_COLOR_MATERIAL); FIXME
        glDisable(GL_LIGHTING);
        glDisable(GL_TEXTURE_2D);
        {
            glBegin(GL_TRIANGLES);
            {
                glColor3f(1.0f, 0.0f, 0.0f);

                glVertex3f(              0.0f, GOAL_HEIGHT,        0.0f);
                glVertex3f(GOAL_HEIGHT * 0.2f, GOAL_HEIGHT * 0.9f, 0.0f);
                glVertex3f(              0.0f, GOAL_HEIGHT * 0.8f, 0.0f);

                glVertex3f(              0.0f, GOAL_HEIGHT,        0.0f);
                glVertex3f(              0.0f, GOAL_HEIGHT * 0.8f, 0.0f);
                glVertex3f(GOAL_HEIGHT * 0.2f, GOAL_HEIGHT * 0.9f, 0.0f);
            }
            glEnd();

            #ifdef __PSP__
            glBegin(GL_TRIANGLE_STRIP);
            #else
            glBegin(GL_QUAD_STRIP);
            #endif
            {
                for (i = 0; i <= n; i++)
                {
                    float x, y;
                    fsincosf(2.f * PI * i / n, &x, &y);
                    x *= 0.01f;
                    y *= 0.01f;

                    glColor3f(1.0f, 1.0f, 1.0f);
                    glVertex3f(x, 0.0f,        y);
                    glVertex3f(x, GOAL_HEIGHT, y);
                }
            }
            glEnd();
        }
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_LIGHTING);
        //glDisable(GL_COLOR_MATERIAL); FIXME
    }
    glEndList();
}
Exemple #5
0
void video_push_persp(float fov, float n, float f)
{
    GLfloat m[4][4];

    GLfloat r = fov / 2.f * V_PI / 180.f;
    GLfloat s, c;
    
    fsincosf(r, &s, &c);
    c /= s;

    GLfloat a = ((GLfloat) config_get_d(CONFIG_WIDTH) /
                 (GLfloat) config_get_d(CONFIG_HEIGHT));

    glMatrixMode(GL_PROJECTION);
    {
        glPushMatrix();
        glLoadIdentity();

        m[0][0] =  c/a;
        m[0][1] =  0.0f;
        m[0][2] =  0.0f;
        m[0][3] =  0.0f;
        m[1][0] =  0.0f;
        m[1][1] =    c;
        m[1][2] =  0.0f;
        m[1][3] =  0.0f;
        m[2][0] =  0.0f;
        m[2][1] =  0.0f;
        m[2][2] = -(f + n) / (f - n);
        m[2][3] = -1.0f;
        m[3][0] =  0.0f;
        m[3][1] =  0.0f;
        m[3][2] = -2.0f * n * f / (f - n);
        m[3][3] =  0.0f;

        glMultMatrixf(&m[0][0]);
    }
    glMatrixMode(GL_MODELVIEW);
}
Exemple #6
0
void mark_init(int b)
{
    int i, slices = b ? 32 : 16;

    mark_list = glGenLists(1);

    glNewList(mark_list, GL_COMPILE);
    {
        glBegin(GL_TRIANGLE_FAN);
        {
            glNormal3f(0.f, 1.f, 0.f);

            for (i = 0; i < slices; i++)
            {
                float x, y;
                fsincosf(-2.f * PI * i / slices, &x, &y);

                glVertex3f(x, 0, y);
            }
        }
        glEnd();
    }
    glEndList();
}