intro to computer graphics: just enough c++ › courses › fall2019 › tutorial_material ›...
TRANSCRIPT
![Page 1: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/1.jpg)
Intro to Computer Graphics:Just enough C++
Updated: September 10th, 2019
Slides by: Philmo Gu
![Page 2: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/2.jpg)
Java vs C++
Source: https://www.educba.com/c-plus-plus-vs-java/
![Page 3: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/3.jpg)
Java vs C++
Source: https://www.educba.com/c-plus-plus-vs-java/
![Page 4: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/4.jpg)
Hello World!
For C++ For Java
![Page 5: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/5.jpg)
Preprocessors
• Separate programs that manipulate the text in each code file
![Page 6: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/6.jpg)
Namespace
• An area code for identifier to be unique
Source: https://www.learncpp.com/cpp-tutorial/4-3b-namespaces/
![Page 7: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/7.jpg)
Namespace
• An area code for identifier to be unique
Source: https://www.learncpp.com/cpp-tutorial/4-3b-namespaces/
![Page 8: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/8.jpg)
Overloading Operators
• Operation = mathematical calculation involving one or more inputs that produces a new value (output)• Operator = symbol(s) that specify an operation
Source: https://www.learncpp.com/cpp-tutorial/introduction-to-literals-and-operators/
![Page 9: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/9.jpg)
Struct and Classes
• By Default:• Struct = Public members
• Class = Private members
![Page 10: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/10.jpg)
Values and Pointers
• Pointer = memory address to a value• & = address-of operator
• * = dereference operator
Source: https://www.learncpp.com/cpp-tutorial/67-introduction-to-pointers/
![Page 11: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/11.jpg)
Values and Pointers
• Pointer = memory address to a value• & = address-of operator
• * = dereference operator
Source: https://www.learncpp.com/cpp-tutorial/67-introduction-to-pointers/
![Page 12: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/12.jpg)
Example Code
![Page 13: Intro to Computer Graphics: Just enough C++ › courses › Fall2019 › Tutorial_Material › … · Intro to Computer Graphics: Just enough C++ Updated: September 10th, 2019 Slides](https://reader033.vdocuments.mx/reader033/viewer/2022060321/5f0d2ae57e708231d4390145/html5/thumbnails/13.jpg)
Exercises
• Create a pattern of nested squares and diamonds, and print out the vertices of each level
• Create the Sierpinski triangle using triangles, and print out the vertices of each iteration
Image Credit: CPSC 453 (Fall 2018) Assignment 1: Points, Lines and Triangles by Sonny Chan