can anyone explain me the code from here ?

Discussion in 'Programming General' started by Sunos, Jan 11, 2015.

can anyone explain me the code from here ?
  1. Unread #1 - Jan 11, 2015 at 5:25 PM
  2. Sunos
    Joined:
    Nov 23, 2014
    Posts:
    80
    Referrals:
    0
    Sythe Gold:
    0

    Sunos Choose good things and good things will choose you
    Banned

    can anyone explain me the code from here ?

    Hello ,

    I got a project downloaded from internet in C++ and i need to explain the code to my teacher .
    Can someone give me a explanation please ?

    code :

    #include <GL/freeglut.h>
    #include <stdlib.h>

    void initGL(int width, int height)
    {
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(45.0f, (GLfloat) width / (GLfloat) height, 2.0f, 100.0f);

    glMatrixMode(GL_MODELVIEW);
    }

    static void display(void)
    {
    glLoadIdentity();

    glPushMatrix();
    glTranslatef(0.0, 0.0, -10);
    glRotatef(60, 1, 0, 0);
    glRotatef(60, 0, 1, 0);
    glutSolidCube(2);
    glPopMatrix();

    glFlush();
    }

    static void idle(void)
    {
    glutPostRedisplay();
    }

    int main(int argc, char *argv[])
    {
    int width = 640;
    int height = 480;

    glutInit(&argc, argv);
    glutInitWindowSize(width, height);
    glutInitWindowPosition(10, 10);
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);

    glutCreateWindow("Hello world!");

    glutDisplayFunc(display);
    glutIdleFunc(idle);

    initGL(width, height);

    glutMainLoop();

    return EXIT_SUCCESS;
    }
     
  3. Unread #2 - Jan 12, 2015 at 12:34 AM
  4. 70i
    Joined:
    Jan 11, 2014
    Posts:
    462
    Referrals:
    0
    Sythe Gold:
    174

    70i Forum Addict
    Banned

    can anyone explain me the code from here ?

< Centauri | Mentoring people in the C++ language >

Users viewing this thread
1 guest


 
 
Adblock breaks this site