Lab 1a

2D Transformations and Interactions - 2D Tetris

Due: Sunday, March 25th 2018, 23:55

Start Early!!!


Individual Effort:
No team participation is really encouraged in the case of the homework or the labs.
You're are not allowed to use any libraries or extra code except gl-matrix, webgl-utils.js and some helper functions in order to initialize WebGL / load shaders. Especially Three.js is not allowed! If you're not sure or want to use some library, ask the teaching assistant first.
Late Submission:
Don't get behind in the lab assignments - always start early!
In this course you will have a total of 4 (four) grace days that you can distribute however you like. See here for more information on grace days.

Objectives:


Do the following before you proceed:


Goal:

The goal of this lab is to implement a first graphics program and learn how to handle geometry, rotation as well as translation, and user interaction. Most of the concepts are laid out in the book as well as in class including example programs.


Tasks:

Follow this guideline step-by-step, but be sure to read the overall text before you start. (So you can make some design decisions before you start, reading further steps in Assignments 1b and 3 will also help you in choosing the right structure for you code.) Make sure that you thoroughly test your program after each step so that you can find bugs easier and quicker. It's possible to solve the entire task in 2D, but it'll make future work easier for you to think about how to design the game to make an extension to 3D as easy as possible.

(15%) Set up a drawing window and draw a simple box
Set up a basic WebGL program, which initializes the drawing window.

(25%) Draw your first block
Define two primitives - one made of 2x2 blocks (or units) and one made of 1x4 blocks. Draw these 2 objects at arbitrary places on the screen. Assign a random color to each object. Make the size of a block (also called 'unit') a user defined variable, which we'll need for the tasks below. Basically if you have one pixel per block, you will only see a very tiny object. If you have 10 pixels per block (that is meant per one side of the block, hence the block would have 10^2 = 100 pixels really), things would be magnified.

(60%) Add simple user interaction and animations
Respond to user interaction from the keyboard. Implement the following:

Animate the transformations and make sure to make them frame rate independent. We want smooth transitions (which means you really 'see' the intermediate steps when a block is rotating).


Extra Credit (max 7%)

(2%) Background image
Replace the boring black background with any image you would like to. This could be a landscape, a geometric pattern or anything else you would like to have there.

(2%) Multiple colors
Assign some pattern of multiple colors to the blocks to make them look more beautiful. We would like to see a creative idea here.

(3%) Tetris shapes
Instead of the boring block add more complex Shapes as you can usually find for tetris. You might want to think of T-shaped, L-shaped objects or something stairlike.


Hints


Submission


Grading Criteria

Grading the labs will be based on the following:
Last modified: February 28, 2018
Lukas Herzberger / lukas DOT herzberger AT univie DOT ac DOT at