I think this assignment should have 8 objectives but we should still mark it out of 10. The Mean TA.

Similar documents
CS 548: COMPUTER GRAPHICS PORTRAIT OF AN OPENGL PROGRAM SPRING 2015 DR. MICHAEL J. REALE

Tutorial 04. Harshavardhan Kode. September 14, 2015

Rendering Objects. Need to transform all geometry then

Tutorial 1: Your First Triangle!

CS475/CS675 - Computer Graphics. OpenGL Drawing

CS1950U Setup Spring 2018

Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

Programming shaders & GPUs Christian Miller CS Fall 2011

Shaders. Slide credit to Prof. Zwicker

Introduction to the Graphics Module Framework

WebGL A quick introduction. J. Madeira V. 0.2 September 2017

I consider this assignment to be a gift. A former CS 488 TA s evaluation of Assignment 3.

Using Flash Animation Basics

[175 points] The purpose of this assignment is to give you practice with shaders in OpenGL.

3d Programming I. Dr Anton Gerdelan

Building Models. Prof. George Wolberg Dept. of Computer Science City College of New York

Outline. Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s)

Computer Graphics CS 543 Lecture 4 (Part 2) Building 3D Models (Part 2)

Computer Graphics (CS 543) Lecture 1 (Part 2): Introduction to OpenGL/GLUT (Part 1)

We assume that you are familiar with the following:

OpenGL. Shading Language. Third Edition

Practical 1: OpenTK Tutorial

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

Deferred Rendering Due: Wednesday November 15 at 10pm

Hands-On Workshop: 3D Automotive Graphics on Connected Radios Using Rayleigh and OpenGL ES 2.0

OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders

COMP371 COMPUTER GRAPHICS

Computer Graphics (CS 543) Lecture 4a: Linear Algebra for Graphics (Points, Scalars, Vectors)

The Graphics Pipeline

Tutorial 2 Part B: The View Matrix & Frame Rates

Advanced Lighting Techniques Due: Monday November 2 at 10pm

To familiarize of 3ds Max user interface and adapt a workflow based on preferences of navigating Autodesk 3D Max.

Getting Started with Silo

Using Microsoft Word. Working With Objects

Lab 2-3D Transformations and Vertex Shaders

Unit 1, Lesson 1: Moving in the Plane

1 Getting started with Processing

CENG 477 Introduction to Computer Graphics. Graphics Hardware and OpenGL

To build shapes from scratch, use the tools are the far right of the top tool bar. These

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

10 Connector Designer

last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders

CS559 Computer Graphics Fall 2015

Programming with OpenGL Complete Programs Objectives Build a complete first program

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

Ciril Bohak. - INTRODUCTION TO WEBGL

Project 2: 3D transforms and Cameras

Lecture 12: Mid-term test solution & project. CITS 3003 Graphics & Animation

COS 116 The Computational Universe Laboratory 10: Computer Graphics

CS452/552; EE465/505. Review & Examples

Blender Lesson Ceramic Bowl

CS12020 (Computer Graphics, Vision and Games) Worksheet 1

Intermediate Microsoft Office 2016: Word

Practical 1: OpenTK Tutorial

Overview. By end of the week:

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

Spreadsheet View and Basic Statistics Concepts

-Using Excel- *The columns are marked by letters, the rows by numbers. For example, A1 designates row A, column 1.

CS559 Computer Graphics Fall 2015

Curves & Splines. Assignment #3. Overview & Objectives. Due Dates. CPSC 453 Fall 2018 University of Calgary

Minecraft Due: March. 6, 2018

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell

Drawing Shapes on a Coordinate Grid

6.S096 Lecture 9 Visualization

Open GL Framework For A Computer Graphics Course

CS452/552; EE465/505. Image Processing Frame Buffer Objects

Computer Graphics Coursework 1

CS 130 Final. Fall 2015

Android and OpenGL. Android Smartphone Programming. Matthias Keil. University of Freiburg

From system point of view, a graphics application handles the user input, changes the internal state, called the virtual world by modeling or

4 TRANSFORMING OBJECTS

Name: Date: Multimedia Graphics and Web Publishing Mr. Dietzler. Flash Topics TWEENING AND MOTION GUIDES

3ds Max Cottage Step 1. Always start out by setting up units: We re going with this setup as we will round everything off to one inch.

3 Polygonal Modeling. Getting Started with Maya 103

Virtual MODELA USER'S MANUAL

How to draw and create shapes

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 1 The Blender Interface and Basic Shapes

CPSC 436D: Video Game Programming Intro to Game Graphics Assignment

Chapter 4 Determining Cell Size

ARCHITECTURE & GAMES. A is for Architect Simple Mass Modeling FORM & SPACE. Industry Careers Framework. Applied. Getting Started.

Gwenview User Manual. Aurélien Gâteau Christopher Martin Henry de Valence

Chapter 10. Creating 3D Objects Delmar, Cengage Learning

Getting Started with ShowcaseChapter1:

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

Using Microsoft Excel

Transforming Objects in Inkscape Transform Menu. Move

NOTES TO CONSIDER BEFORE ATTEMPTING EX 1A TYPES OF DATA

OpenGL SC. March Sean Harmer Managing Director UK

Unit 14: Transformations (Geometry) Date Topic Page

Quick Shader 0.1 Beta

The print queue was too long. The print queue is always too long shortly before assignments are due. Print your documentation

Introduction to 2D Graphics

CS 4620 Midterm, March 21, 2017

MolSlicer A Tool For Removing Sections Of mol2mel Molecules. Rob Gillespie Student Consultant Imaging Technology Group

CISC 1600, Lab 2.3: Processing animation, objects, and arrays

Transcription:

Chapter 1 CS488/688 F17 A1: Introduction I think this assignment should have 8 objectives but we should still mark it out of 10. The Mean TA. This assignment is due Thursday, September 28th [Week 3]. 1.1 Topics Exposure to OpenGL Callback-based program structure Qt user interfaces 1.2 Statement This assignment will get you started writing graphics applications using OpenGL. It will also familiarize you with the set of languages and APIs we will be using for subsequent assignments. You will be writing a user interface in C++ using the Qt toolkit. The user interface will be wrapped around a window in which graphics will be rendered using OpenGL from the C++ application. In particular, the program is a game in which the user must manipulate falling tetrominoes so as to make complete lines at the bottom of a well. When lines are completed, they are removed from the game. When the well fills up, the game is over. Any resemblance between this game and a popular arcade game of Russian extraction from the 1980s is purely coincidental. You will also implement some graphical functionality not directly related to game play, but that will help you develop OpenGL 3.2 skills needed in later assignments. 1.3 The game The game takes place in a U-shaped well of unit cubes enclosing a grid of width 10 and height 20 in which tetrominoes can fall. The blocks occupy discrete positions in the grid (they don t fall smoothly, but jump from position to position). 1

2 CS488/688 Fall 2017 Introduction to Computer Graphics Tetrominoes start in a four unit tall stripe on top of the well. Every time a predetermined interval elapses, the current tetromino falls one unit. A value of 500ms is a good novice interval; 100ms is more challenging. At any time, the current piece can be moved to the left or right, rotated clockwise or counter-clockwise, and dropped the rest of the way down the well. When the piece can fall no further, it stops, and any rows in the well that are completely filled are removed from the game. The game ends when a piece cannot clear the starting stripe. You should have at least three different speeds at which the pieces fall. The game should be drawn from unit cubes. The well and the various piece shapes should all be drawn in different colours. You should add a new game piece. The piece must not be a rotation or reflection or shift of an existing piece. However, your new piece does not need to be a tetrominoe; i.e., it may be composed of more (or less) than four cubes. 1.4 The interface The user interface should be written in Qt, a cross-platform application and UI framework for C++ developers. You will need to implement the following functionality (the letters in () indicate the keyboard shortcut; remember, both upper and lower case should work for the keyboard shortcut): An Application menu with the following menu items: New game (N): Start a new game. N. Reset (R): Reset the view of the game. Quit (Q): Exit the program. (This one should already be implemented; be sure not to break it.) A Draw Mode menu with the following menu items: Wire-frame (W): Draw the game in wire-frame mode. Face (F): Fill in the faces in the game. Each different piece shape should have its own uniform colour. Multicoloured (M): Similar to Face mode, but each cube has six faces of different colours (i.e., no two faces should have the same colour). The Draw Mode menu should use radio buttons to indicate which state is selected. A radiobutton Speed menu with at Slow (1), Medium (2), and Fast (3) speeds that sets the rate at which pieces fall. The game may use additional speeds, but you need to be able to set the speed to one of the three. Mouse movements: Mouse operations should be initiated by pressing the appropriate mouse button and terminated by releasing that button. Only motion in the horizontal direction should be used.

CS488/688 Fall 2017 Mann 3 The left mouse button should rotate the game around the X-axis. The middle mouse button should rotate the game around the Y -axis. The right mouse button should rotate the game around the Z-axis. When the shift key is pressed, all mouse buttons should uniformly scale the game (both the board and the pieces). When the mouse moves to the left, the game should become smaller, and when the mouse moves to the right the game should become larger. The maximum and minimum scales should be restricted to a reasonable range. You must make reasonable decisions about how much to scale or rotate for every pixel s worth of mouse motion. For example, if the mouse isn t moving, there should be no scaling or rotation. You are also required to implement a feature sometimes known as persistence or gravity. If, while rotating, the mouse is moving at the time that the button is released, the rotation should continue on its own. This decision should be made at the time of release; after that, it should persist independently of mouse movement, until the next button press. Game play: The left arrow key should move the currently falling piece one space to the left. The right arrow key should move the current piece one space to the right. The up arrow key should rotate the current piece counter-clockwise. The down arrow key should rotate the current piece clockwise. The space bar should drop the piece, sending it as far down in the well as it will go. 1.5 Qt and OpenGL In this course, user interfaces are written in Qt, a cross-platform application and UI framework for C++ developers. If you opt to not to use Qt, you will need to use the following OpenGL commands:

4 CS488/688 Fall 2017 Introduction to Computer Graphics Shader Program Drawing Objects Other glcreateshader glgenvertexarrays glenable glsourceshader glbindvertexarray gldisable glcompileshader glgenbuffers glclear gldeleteshader glbindbuffer glclearcolor glcreateprogram glbufferdata glattachshader glenablevertexarray gllinkprogram glvertexattribpointer gldetachshader gldrawarrays gldeleteprogram gldisablevertexarray glvalidateprogram glvertexattrib* gluseprogram gluniform* glgetattriblocation glgetuniformlocation (Of course, you may find that you will want to use additional OpenGL functionality to add extra features. Note that the Matrix4x4 class stores its matrices in row-major order, but OpenGL expects matrices in column-major order.) If you have chosen to use Qt, you will use the following objects which replace some OpenGL calls and classes you have to make. For more information, go to Qt Documentation. Classes QOpenGLBuffer (replaces gl(gen Bind)Buffer(data)) - Qt 5.1+ QOpenGLArrayBuffer (replaces gl(gen Bind)VertexArray) - Qt 5.1+ QGLBuffer (same as QOpenGLBuffer) - Qt 5.0 QGLShaderProgram (replaces all Shader Program calls) Each class has replaces certain OpenGL calls while making the interface simpler. Please look at the documentation for the full class descriptions. 1.6 The Skeleton Program If your account is correctly set up, you will find a skeleton program in the cs488/a1/src subdirectory of the source distribution. The program creates a user interface with an OpenGL window. As a test, it draws triangles where the corners of your game (not including the well) should appear. The camera is set up so that the triangles appear centered and correctly sized. You need to modify this code to render the current state of the game and respond to user interface events. Here s a to-do list, with a suggested order that will help you make your way through the assignment.

CS488/688 Fall 2017 Mann 5 Write a function to draw a unit cube using OpenGL. If you re already familiar with OpenGL 3.2, you can write a single cube to a Vertex Buffer Object (VBO). You would then create a Matrix4x4 model matrix for each cube and use the matrix functions to translate, rotate, scale this model. In your render function, draw a U-shaped border for the well out of cubes. Implement face rendering and wireframe rendering. Implement rotation and scaling. You should be able to see the effect on the well. A new piece shape has been added. Add code to draw the current contents of the game. Each piece type should be drawn in a different colour; the colours are up to you. Note that color manipulation happens in the fragment shader. Hook up a simple timer (using the QTimer class) that calls down to the game s tick method and re-renders. You should be able to see pieces falling. Implement the rest of the controls for game play and the remaining user interface details. 1.7 Donated code The skeleton program comes with the following files: main.cpp The entry point for the program. viewer.hpp, viewer.cpp The OpenGL widget. All of the OpenGL-related code is here. appwindow.hpp, appwindow.cpp The application window code. Most of the UI-related code (menubars, etc.) is in these two files. game.cpp, game.hpp An engine that implements the core of the falling blocks game. game488.pro Used to create a Makefile that includes all Qt libraries Makefile Used to compile the program with make. shader.vert Vertex Shader used to determine the position of every vertex shader.frag Fragment Shader used to determine the color of each pixel You should be able to get the skeleton program running using the commands qmake game488.pro; make;./game488. Additional information can be found at Qt Documentation: http://qt-project.org/doc/qt-5/index.html

6 CS488/688 Fall 2017 Introduction to Computer Graphics 1.8 Deliverables These executable files should be put in the directory cs488/handin/a1: game488 The program executable. All source files should be in the directory cs488/handin/a1/src. Don t forget screenshot01.png 1.9 Hints, tips, and ideas There are lots of ways this simple application could be modified to enhance playability and attractiveness. You are encouraged to experiment with the code to implement these sorts of changes, as long as you have already met the assignment s basic objectives. Here are some suggestions: As the game progresses (ie, as more filled rows are removed from the game), have the pieces fall at a faster rate. A scoring mechanism. Head-to-head networked play. Modified cubes for pieces. The blocks look much better if individual cubes have their edges slightly beveled. Animations for certain events. The board can spin around when you lose, for example. Add lighting. If you make extensive modifications to the game, you should make sure to run in a compatibility mode mode by default you should support at least the user interface required by the assignment. You can activate your extensions either with a special command line argument or a menu item.

CS488/688 Fall 2017 Mann 7 1.10 Objectives: Assignment 1 Due: Thursday, September 28th [Week 3]. Name: UserID: Student ID: 1: Wireframe mode works. 2: Face colour mode works. 3: Multicoloured face mode works. 4: Pieces fall at three or more speeds. 5: A new piece has been added to the game. 6: The user interface works as specified (menus, mouse interaction, etc). 7: The game can be rotated. 8: The game can be scaled. 9: The game is playable (i.e., you can move the pieces as described under game play of the assignment specification). 10: Persistence works for rotation. Declaration: I have read the statements regarding cheating in the CS488/688 course handouts. I affirm with my signature that I have worked out my own solution to this assignment, and the code I am handing in is my own. Signature: