Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
The main objective of this programming assignment is to develop a simple 2D animation program based on the transformation and collision handling of commonly-used 2D primitives like circles, rectangles,triangles, etc. You will also learn more about OpenGL’s rendering pipeline (to be specific, shaderuniforms and tessellationshaders.)
Starting from this programming assignment, you will be granted complete access to the arsenal of modern OpenGL. Please feel free to explore different OpenGL commands, shaders, and other functionalities,including those not mentioned in our lectures. Please note that you are still required to use OpenGL in the core-profile mode (modern OpenGL). Deprecated functions in immediate mode (legacy OpenGL) are not permitted.
We will also pay more attention to performance. You are required to implement the animation of primitives via shader uniforms (to be specific, by updating transformation matrices.) You are not allowed to apply transformations in the main C/C++ program and flush the whole vertex buffer to the rendering pipeline for every frame. Moreover, you are also required to draw parametric curves with OpenGL tessellation shaders (rather than rasterize them manually in the C/C++ program and flush huge vertex buffers.)
Before you continue, please review the course materials and the handout documents carefully. If your tessellationshaderis not working, you could try to disable the 3D Acceleration feature of your VMWare host.
Please refer to the TA Help Page for general requirements, and take note that all deadlines are strictly enforced. To prevent late submissions caused by network issues, avoid submitting at the last minute! Please also note that your credits for this programming assignment will be scaled by 50% (i.e., from 200 + 80 to 100 + 40) on Brightspace to match the overall grading schemes.
1 Base Part (200 points)
Figure 1: Illustration for a 2D animation based on a bouncing face (its interior is not shown.)
Write a program to animate bouncing faces in a rectangular viewport, as illustrated in Figure 1. We are still focusing on 2D graphics, so our bouncing faces are essentially bouncing disks (circles). Please note that it is required to draw circles via OpenGL tessellation shaders (which is the common routine in OpenGL to render parametric curves/surfaces.)
To be specific, a bouncing face consists of two round eyes and a triangular mouth (Figure 2(a)). This is the 1-st generation (detailed later) of the face. Note that the centers of the circles of the two eyes and the face itself all have the same y-coordinate. The radius of each smaller (eye) circle is half
Figure 2: Illustration of the bouncing faces and their evolution rules. For a 1-st generation bouncing face which is centered at (0, 0) with radius 1, its left eye should be centered at ( −0.5, 0) with radius 0.5, its right eye should be centered at (0.5, 0) with radius 0.5, and the three vertices of its mouth should be ( −0.25, −0.5), (0.25, −0.5), and (0, −0.75). Bouncing faces with other generations should have their components scaled and translated accordingly.
of that of the larger (face) circle. The 2-nd generation of the face has a smaller version of the face in one of the eyes (Figure 2(b)). The 3-rd generation of the face has a smaller version of the face in each of the eyes (Figure 2(c)). Generation 4, 5, 6, and 7 faces will have more eyes converted to faces. Similarly, generations 8 through 15 add another level of recursion.
The faces move until they hit either another face or the viewport boundary. We assume that the surface is horizontal, flat, and smooth. We also assume that all collisions are completely elastic. That is, the objects obey the laws of physics: the conservation of energy and the conversation of momentum. As an edge case, when a bouncing face hits the viewport boundary (i.e., hits a wall), it bounces back with reflected velocity, i.e., with the same speed and a reflected direction.
The rules of generation evolution are as follows: (1) All faces start at the 1-st generation; (2) If two faces collide, each increases its generation by one; (3) If a face collides with a wall, it bounces back with its generation unchanged.
For simplicity, we assume that no more than two faces would collide at the same time. That is, you do not have to handle collisions involving three or more bouncing faces. You could also assume that all bouncing faces have the same mass (faces with different masses will be handled in the BONUS part.)
Please note that different from previous programming assignments, there is no need to switch between parts (because we only have one part.)