Difference between revisions of "CISC440 S2018 HW1"
(→Graduate students only) |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
Now make a new directory inside the tutorials directory (which should start with "ogl") and move the following provided files into it: | Now make a new directory inside the tutorials directory (which should start with "ogl") and move the following provided files into it: | ||
− | * [ | + | * [https://docs.google.com/document/d/1l6sBtMEsUKiNW0RE9R2HrzbGdkiy6c_CL8kamQxMP3Y/edit?usp=sharing <tt>modified_tutorial03.cpp</tt>] |
− | * [ | + | * [https://drive.google.com/open?id=1PVD0t-syt2bEcNzF1zKgES2Qnb45r_VD vertex shader] |
− | * [ | + | * [https://drive.google.com/open?id=13dBFndrFwq1dnDxDmjmoXUrC2jFYhqwS fragment shader] |
− | + | Instructions for compiling are in the [https://docs.google.com/presentation/d/1fQ_L9rp4NTTOOFmivo8Y8zUcdi520POXdCb9yxsUkto/edit?usp=sharing lecture #5 slides]. | |
+ | |||
+ | <tt>modified_tutorial03.cpp</tt> has a function <tt>draw_triangle()</tt> that takes as arguments a ''different'' model matrix and (r, g, b) color for each isosceles triangle to be drawn. There are also functions for drawing a right triangle, square, and cube. | ||
Your task is to further change <tt>modified_tutorial03.cpp</tt> to do the following: | Your task is to further change <tt>modified_tutorial03.cpp</tt> to do the following: | ||
− | * Create a new 3-D [https://en.wikipedia.org/wiki/Polyhedron polyhedron] from multiple transformed versions of the isosceles triangle, right triangle, and/or square. See draw_cube() for an example of how to do this. It does not need to be a regular polyhedron -- you can make a rubber ducky or any other [http://i.kinja-img.com/gawker-media/image/upload/s--KMPf9Vy5--/yc7sj7zdwn2o7zacyfsg.jpg wacky shape] that you want | + | * Create a new 3-D [https://en.wikipedia.org/wiki/Polyhedron polyhedron] from multiple transformed versions of the isosceles triangle, right triangle, and/or square. See <tt>draw_cube()</tt> for an example of how to do this. It does not need to be a regular polyhedron -- you can make a rubber ducky or any other [http://i.kinja-img.com/gawker-media/image/upload/s--KMPf9Vy5--/yc7sj7zdwn2o7zacyfsg.jpg wacky shape] that you want. You can also change the color of every facet if you want. '''[6 points]''' for creativity/complexity. |
− | * Arrange multiple (≥ 10) copies of your object in a 2-D pattern | + | * Arrange multiple (≥ 10) copies of your object in a 2-D pattern, varying the color and scale/orientation/location of the objects -- think "objects on a tabletop" or "buildings in a neighborhood". '''[3 points]''' for enough appropriately-transformed copies, '''[3 points]''' for creativity/aesthetics of the pattern. |
− | * | + | * Create a ''plan'' view and an (approximately) ''isometric'' view of your model with different parameters to <tt>glm::lookat()</tt>. Make the camera close enough that the object pattern fills most of the window. '''[3 points]''' |
− | |||
− | |||
You should not need to go into the the shader files, and you should not change <tt>draw_triangle()</tt> or any of the other <tt>draw_X()</tt> functions. Only add new functions, and call them in the appropriate location in the drawing loop. | You should not need to go into the the shader files, and you should not change <tt>draw_triangle()</tt> or any of the other <tt>draw_X()</tt> functions. Only add new functions, and call them in the appropriate location in the drawing loop. | ||
− | + | When you are done, submit <tt>modified_tutorial03.cpp</tt> (with your name added in the header section to attest that YOU did the coding) and a screenshot for each view to Canvas. Make sure it is easy to switch between plan view and isometric view in code (commenting out different version of <tt>glm::lookat()</tt> is fine). | |
− | |||
− | When you are done, submit <tt> | ||
==Graduate students only== | ==Graduate students only== | ||
− | * Your calls to | + | * Your 3-D polyhedron must have at least 20 sides |
− | * Your pattern must have ≥ 100 | + | * Your calls to draw the polyhedron that you created cannot be "hard-coded" to make pattern. Rather, you must programmatically create a pattern such as a [https://en.wikipedia.org/wiki/List_of_convex_uniform_tilings tiling], a [https://en.wikipedia.org/wiki/Koch_snowflake Koch snowflake], or representation of some other 2-D mathematical function |
− | + | * Your pattern must have ≥ 100 copies of your 3-D shape |
Latest revision as of 14:21, 16 February 2018
Due Tuesday, February 27 midnight
This assignment is designed to make sure you are ready to compile and run OpenGL 3.3 programs, and to familiarize you with basic GLM functions 2-D and 3-D transformations. It is based on a modified version of OpenGL Tutorial #3 (Matrices) -- see below to get the template code you will start with.
Instructions
First, get OpenGL 3.3, GLFW installed using instructions in OpenGL Tutorial #1 regarding installation on your system. To be sure it is working, run the program, which just pops up an empty (black) window. If you see that, you are ready to proceed with the actual assignment.
Now make a new directory inside the tutorials directory (which should start with "ogl") and move the following provided files into it:
Instructions for compiling are in the lecture #5 slides.
modified_tutorial03.cpp has a function draw_triangle() that takes as arguments a different model matrix and (r, g, b) color for each isosceles triangle to be drawn. There are also functions for drawing a right triangle, square, and cube.
Your task is to further change modified_tutorial03.cpp to do the following:
- Create a new 3-D polyhedron from multiple transformed versions of the isosceles triangle, right triangle, and/or square. See draw_cube() for an example of how to do this. It does not need to be a regular polyhedron -- you can make a rubber ducky or any other wacky shape that you want. You can also change the color of every facet if you want. [6 points] for creativity/complexity.
- Arrange multiple (≥ 10) copies of your object in a 2-D pattern, varying the color and scale/orientation/location of the objects -- think "objects on a tabletop" or "buildings in a neighborhood". [3 points] for enough appropriately-transformed copies, [3 points] for creativity/aesthetics of the pattern.
- Create a plan view and an (approximately) isometric view of your model with different parameters to glm::lookat(). Make the camera close enough that the object pattern fills most of the window. [3 points]
You should not need to go into the the shader files, and you should not change draw_triangle() or any of the other draw_X() functions. Only add new functions, and call them in the appropriate location in the drawing loop.
When you are done, submit modified_tutorial03.cpp (with your name added in the header section to attest that YOU did the coding) and a screenshot for each view to Canvas. Make sure it is easy to switch between plan view and isometric view in code (commenting out different version of glm::lookat() is fine).
Graduate students only
- Your 3-D polyhedron must have at least 20 sides
- Your calls to draw the polyhedron that you created cannot be "hard-coded" to make pattern. Rather, you must programmatically create a pattern such as a tiling, a Koch snowflake, or representation of some other 2-D mathematical function
- Your pattern must have ≥ 100 copies of your 3-D shape