CP411-A1 C++/Eclipse/OpenGL/GLSL

Objectives

  • Introduction to the basic concepts of computer graphics hardware
  • Install and test C/C++, OpenGL and development environment
  • Prepare assignment submission

Preparations

  1. Software installation
  • If you are using Mac machine, you are recommended to install dual boot or virtual machine of Windows OS to run the provided CP411 software.
  • We need basic packaging software like 7zip for submission packaging. We will use VS code with C/C++ IntelliSense extension as default IDE for programming tasks.
  • Download cp411_software_mingw64.zip, save it to the C: folder, and extract there (right click it > 7-Zip > Extract Here). Then C:/cp411 will be the root folder of the course software system. We will use this folder as the default root folder in the follow-up descritions. Open C:/cp411/README.md, and follows its instructions to install and configure the required software.
  1. Assignment workspace
  • It is recommended to use C:/cp411/assignments/a1 directory for program projects and submission files of a1, and C:/cp411/assignments/a1/images directory to store images of a1. We will use these directories in the following task specifications.
  • Download readme.txt and a1_report.md (right click the hypertext > Save link as) and save them to folder C:/cp411/assignments/a1.
  • Read the readme.txt file to see the mark distribution of the graded tasks. Check the a1_report.md file for the template of a1 report. Be prepared to take screen shot for each graded item.
  • Check the submission section at end of this document to see the submission requirements. Refer to this a1_sample for an example of submission package.

Concepts of raster display systems

Use your own words to explain briefly the following terms of raster display systems. Write your short answer in a1_report.md file.

framebuffers, pixels, color depth, and resolution

Frame, refreshment, and refresh rate

Concepts of image rendering

Use your own words to answer briefly the following terms. Write your short answer in a1_report.md file.

What are the two basic image rendering approaches? and what are their differences?

Why rasterization is commonly used in graphics applications?

Roles of CPU and GPU in CG

Use your own words to explain briefly the roles of CPU and GPU in computer graphics computing.

CPU roles

GPU roles

C/C++ OpenGL programming environment

You will do the following tasks.

  1. Test OpenGL provided example
  2. Test OpenGL GLSL provided example.
  3. Create a simple OpenGL C project.
  4. Create a simple OpenGL C++ project.

C/C++ OpenGL installation

Assume that you have installed and configured the CP411 software environment in preparation.

Test OpenGL

  1. Download, save, and extract cube.zip project to the a1/lab folder, then cube folder is under a1/lab.
  2. Open the cube folder in VS code, it contains two files cube.c, REAMDE.md. cube.c is an OpenGL C program. Follow the instructions in README.md to compile and run the cube.exe program. It creates a window of title “red 3D light cube”.
  3. Take a screen shot of the cube display window, and save it as C:/cp411/a1/images/cube.png. Under Windows OS, this can be done by (a) use shift + window + S, (b) use mouse to clip the area, (c) open Paint program, (d) paste the clip image, (e) resize, (f) save as, choose png, browser to the a1/images folder, Save.

Test OpenGL + GLSL

  1. Download, save, and extract glsl_demo.zip to the lab folder, copy it the folder from cp411/examples.
  2. Open the glsl_demo folder in VS code. This is a C++ OpenGL+GLSL project. Check code in the src folder.
  3. Follow instructions in README.md file to build and the run the program. You will see a shinning teapot. Then it runs GLSL programs vertexshader.txt and fragmenshader.txt on GPU. Take a screen shot to show you get GLSL working.

OpenGL C project

  1. Create a new folder a1/myopengl, and new file myopengl.c and write some OpenGL program, or copy/paste and Mark J. Kilgard’s code from example page say blender.c.
  2. Compile myopengl.c using gcc compiler. Run the program, add take screen shot on displaying graphics.

OpenGL C++ project

  1. Create a new file myopengl.cpp in folder a1/myopengl. Write some OpenGL program in C++, or copy code from glut_test.cpp (get the file by right clicking the link > Save link as)
  2. Compile myopengl.cpp program using g++ compiler. Run and take a screen shot on displaying graphics.
  3. Further add some code to print some message to stdout in myopengl.cpp, and add additional linking libaries -lwinmm, -lgdi32 in compiling. Run the program by double clicking executable.
  4. Write makefile file to build, run, and clean the myopengl project. Test your makefile
  5. Write README.md file telling what this project about, how to build and run the project.

Submission

  1. Sign the readme.txt file by filling in your Name, ID, and do the self-evaluation for each grading item.
  2. Write lab report by adding necessary information to the a1_report.md. Then convert a1_report.md to a1_report.html by command:
    pandoc -i a1_report.md -o a1_report.html
    Make sure that a1_report.html shows the screenshot images.
  3. Select required folders and files in a1 folder to create a zip file, and rename it to a1.zip. The zip file should contain the following files and folders.
readme.txt
a1_report.md
a1_report.html
images (folder)
myopengl (folder)
 
  1. Submit the a1.zip to a1 dropbox on MyLS.

Note: to minimize submission package size, clean projects, namely delete .o and .exe files, before adding it to the submission package.

You can use the following command to package the required files and folders into a zip file

7z a -tzip a1.zip readme.txt a1_report.md a1_report.html images myopengl

End