Beispiel #1
0
Datei: Exe07.c Projekt: jvanz/cg
void exibicaoPrincipal(void)
{
        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
        gluOrtho2D(-20, 20, -20, 20);
        glMatrixMode (GL_MODELVIEW);
        glLoadIdentity ();
        glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        //desenha circulo
        glColor3f(0.0f,0.0,0.0);

        desenhaCirculo(RAIO_EXTERNO,0.f,0.f);
        calculaQuadrado(RAIO_EXTERNO);
        desenhaQuadrado();
        desenhaJoystick();

        glutSwapBuffers();
}
Beispiel #2
0
        void drawGround(){


            float halfW, halfL;
            float limitX, limitZ, startX, startZ;


            for(int i=0; i<NUMGROUNDS; i++){

                halfW = ground[i].wFactor/2;
                halfL = ground[i].lFactor/2;
                int counter = 0;
                limitX = ground[i].centerX + ground[i].width/2 ;//- ground[i].wFactor;
                limitZ = ground[i].centerZ + ground[i].length/2 ;//- ground[i].lFactor;

                startZ = ground[i].centerZ - ground[i].length/2 + ground[i].lFactor;
                startX = ground[i].centerX - ground[i].width/2 + ground[i].wFactor;

                for(int cz = startZ; cz <= limitZ; cz += ground[i].lFactor ){

                    for(int cx = startX; cx <= limitX; cx += ground[i].wFactor ){

                        desenhaQuadrado(
                            cx - halfW, 0, cz + halfL,
                            cx - halfW, 0, cz - halfL,
                            cx + halfW, 0, cz + halfL,
                            cx + halfW, 0, cz - halfL,
                            ground[i].normal[0], ground[i].normal[1], ground[i].normal[2],
                            ground[i].color[0], ground[i].color[1], ground[i].color[2], ground[i].color[3]
                        );

                        counter++;

                    }
                }
            }

        }