1. Homepage
  2. Programming
  3. SWS3005: Real-Time Graphics Rendering (2022) - Assignment 1 OpenGL

SWS3005: Real-Time Graphics Rendering (2022) - Assignment 1 OpenGL

Engage in a Conversation
SWS3005Real-Time Graphics RenderingNUSAssignment 1 OpenGLC++

SWS3005: Real-Time Graphics Rendering (2022) CourseNana.COM

Assignment #1 (Individual Work) CourseNana.COM

  CourseNana.COM

LEARNING OBJECTIVES CourseNana.COM

OpenGL viewing, OpenGL transformations, hierarchical modeling, and animation. After CourseNana.COM

completing the programming assignment, you should have learned CourseNana.COM

·      how to set up the view transformation (camera position and orientation) in OpenGL, CourseNana.COM

·      how to set up perspective viewing in OpenGL, CourseNana.COM

·      how to use the OpenGL transformations for modeling, and CourseNana.COM

·      how to use the OpenGL transformations for animation. CourseNana.COM

  CourseNana.COM

TASKS CourseNana.COM

Please download the ZIP file sws3005_2022_assign1_todo_(*).zip from the Assignments folder in LumiNUS Files. CourseNana.COM

  CourseNana.COM

You are provided with an incomplete C++ application program main.cpp, and your job is to complete it according to the requirements. CourseNana.COM

  CourseNana.COM

You may try the completed executables: main_done.exe (for Windows), and main_done (formacOS) found in the same ZIP file. (On macOS, you may need to use the command sudo chmod+x main_done to give the file execute permission before running it.) CourseNana.COM

  CourseNana.COM

Please read the instructions shown in the console/terminal window to learn how to operate the program. When you run the program, you should see a spherical planet at the center of the window. CourseNana.COM

  CourseNana.COM

There are a dozen cars moving on the planet surface, and each car moves in a different great circle (you can search the web to find out what a great circle is), and they have different speeds and colors. CourseNana.COM

  CourseNana.COM

You may try the followings on the program: CourseNana.COM

·      resize the window and see what happens, CourseNana.COM

·      press the Up, Down, Left or Right arrow key to change the camera’s position, CourseNana.COM

·      press the Page Up or Page Down key to change the camera’s distance from the planet, CourseNana.COM

·      press the ‘P’ key to pause/resume the animation of the cars. CourseNana.COM

  CourseNana.COM

You will notice that the camera is always looking at the center of the planet. With respect to the planet, the camera’s position can be expressed as latitude and longitude, and its distance from the planet’s center. When the Left or Right arrow key is pressed, the camera’s longitude decreases or increases, respectively; and when the Down or Up arrow key is pressed, the camera’s latitude decreases or increases, respectively. Note that the camera’s up-vector is always pointing north. CourseNana.COM

  CourseNana.COM

Follow the following instructions to complete main.cpp as required. You must not add or change any other files. CourseNana.COM

1) Study the source program very carefully. CourseNana.COM

  CourseNana.COM

2) Complete the DrawOneCar() function. The function must draw the car using only GLUT CourseNana.COM

functions such as glutSolidCube(), glutSolidTorus(), glutSolidCone(), and glutSolidSphere(). You should not directly use any OpenGL geometric primitive. You should make use of the OpenGL 3D transformation functions to help you resize, orientate and position the parts. The functions glPushMatrix() and glPopMatrix() are very helpful for you to save and restore the current transformation before and after drawing each part. You can design your cars any way you like as long as they look like cars. More details about the GLUT functions can be found at https://www.opengl.org/resources/libraries/glut/spec3/spec3.html. CourseNana.COM

  CourseNana.COM

3) Complete the DrawAllCars() function. This function draws each car at the correct position on its great circle. Note that any great circle on a sphere centered at the origin can be defined as follows. Let C be the great circle in the y = 0 plane, and let v be a vector in the x-z plane, and let be an angle. If we rotate C about v by , we get another great circle of the sphere. All great circles of the sphere can be obtained by varying v and CourseNana.COM

  CourseNana.COM

4) Set up the correct perspective viewing volume in the MyDisplay() function. You should use the gluPerspective() function. The near and far planes should be set near the planet’s surface, yet still do not clip off any part of the planet and cars. The near and far planes should vary with the eye’s distance from the planet’s center. You should make use of the value of the predefined constant CLIP_PLANE_DIST to position your near and far planes. CourseNana.COM

  CourseNana.COM

5) Set up the correct view transformation (camera’s position and orientation) in the MyDisplay() function. You may use the gluLookAt() function, or you can use an alternative method. CourseNana.COM

  CourseNana.COM

6) Complete the MyTimer() function. You should use the GLUT timer callback to control the speed of the animation by maintaining a constant frame rate (DESIRED_FPS). Refer to CourseNana.COM

https://www.opengl.org/resources/libraries/glut/spec3/node64.html to find out more about the CourseNana.COM

GLUT function glutTimerFunc(). CourseNana.COM

  CourseNana.COM

More detailed instructions can be found in the unfinished program code. You may add additional constants, global variables and functions to the given program. CourseNana.COM

  CourseNana.COM

DO NOT HARD-CODE VALUES. You should write your code in such a way that when the values of the named constants (defined in the beginning of the program) are changed to other valid values, your program should function accordingly. For example, if the car’s size is changed, the tyre size should vary proportionally. CourseNana.COM

  CourseNana.COM

A Visual Studio 2017 solution main.sln (or Xcode project main.xcodeproj on macOS) is provided for you to build the executable program. In this assignment, you are not required and must not change any other C/C++ source files besides main.cpp. CourseNana.COM

  CourseNana.COM

Besides GLUT (or FreeGLUT), you should not use any other third-party libraries. Your code must compile with either the MSVC++ 2017 (or newer) compiler on Windows, or Clang on macOS. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
SWS3005代写,Real-Time Graphics Rendering代写,NUS代写,Assignment 1 代写,OpenGL代写,C++代写,SWS3005代编,Real-Time Graphics Rendering代编,NUS代编,Assignment 1 代编,OpenGL代编,C++代编,SWS3005代考,Real-Time Graphics Rendering代考,NUS代考,Assignment 1 代考,OpenGL代考,C++代考,SWS3005help,Real-Time Graphics Renderinghelp,NUShelp,Assignment 1 help,OpenGLhelp,C++help,SWS3005作业代写,Real-Time Graphics Rendering作业代写,NUS作业代写,Assignment 1 作业代写,OpenGL作业代写,C++作业代写,SWS3005编程代写,Real-Time Graphics Rendering编程代写,NUS编程代写,Assignment 1 编程代写,OpenGL编程代写,C++编程代写,SWS3005programming help,Real-Time Graphics Renderingprogramming help,NUSprogramming help,Assignment 1 programming help,OpenGLprogramming help,C++programming help,SWS3005assignment help,Real-Time Graphics Renderingassignment help,NUSassignment help,Assignment 1 assignment help,OpenGLassignment help,C++assignment help,SWS3005solution,Real-Time Graphics Renderingsolution,NUSsolution,Assignment 1 solution,OpenGLsolution,C++solution,