Opengl代写: CS3388 – Assignment 1

CS3388 – Assignment 1, 2016

Posted: 22nd September 2016 Due: 7th October 2016, 12:55 PM

Description

This assignment is about creating a simple animation with the rectangles using basic transformations. You should write the code in C/C++ and OpenGL libraries. The assignment is worth 10% of the final mark.

First of all, create an window of size 640 ⇥ 640 in black background. The window will contain at least 15 inanimate rectangles, each of which have their own randomized colours, start positions, initial orientations and dimensions. When the user presses ‘s’ on the keyboard, the animation begins. When the animation begins, the rectangles rotate about their own centres along the z- axis, either clockwise or counter-clockwise (which is also selected randomly). The rectangles also move in randomized directions based of a random 2D vector and the rectangles wrap around the screen in such a manner that when the rectangle disappears beyond the bounds of the screen, it will appear on the opposite side again. Also, the rectangles periodically and rhythmically change shape. However, the colours of each rectangle do not change. When the user presses ‘q’ on their keyboard, the program will exit.

Make sure that the animation is not too fast to visualize properly. Try to make it aesthetically pleasing. You can use glScalef(), glTranslatef(), glRotatef() OpenGL functions for the transformations. You can use sine and cosine waves to cause periodical shape change of the rectangles. The code should be modular enough so that any changes can be made easily. For example, you should define the tunable parameters (e.g. number of rectangles, screen resolution, etc.) as macros on top of the code.

What to submit?

Submit the program file(s) you have implemented. Put all the file(s) into a zip and submit via OWL (no files will be accepted by email). Please don’t submit any unnecessary files (such as the whole project).

1

Late penalty

The late policy is a penalty of 5% per day up to 3 days of lateness. Saturday and Sunday count as one penalty day.

Plagiarism

Copying the code is a serious academic o↵ence, which will be treated as per university norms. Remind that changing variable names and white spaces do not make your code unique, it’s very easy to detect these cases using softwares.

General marking scheme

The marks will be distributed as follows: • Working program: 70%

– (will be divided into di↵erent parts of the assignment) • Documentation: 10%

  • –  Main comment block identifying the student (name, student number, email address): 4%
  • –  Defining input and output parameters for a function: 3%
  • –  Purpose of functions/blocks of code: 3%

    • Program style: 10%

    – Meaningful variable names: 3%
    – Constants instead “magic numbers”: 2%
    – Readability (complete sentences, indentation, white spaces, etc): 2% – Code flows “nicely”: 3%

    • Program structure: 10%

    – Modular code: 4%
    – Uses appropriate data structure: 3%
    – Loops when needed/no loops when not needed: 3%

    2