For additional reading on this topic in the context of computer graphics, I recommend Immersive Linear Algebra, particularly the first four chapters. Some content covered at the site we will not be using now, but will likely revisit later when we move to 3D. For now, it is sufficient to review the topics we cover in class and skip the rest.
You should also read the sections in the learn OpenGL tutorial on Vector and Matrix prelims, and Coordinate Systems. Again, the tutorial uses slightly different syntax since it uses GLM, an OpenGL math library similar to GLSL for C++ (GLSL runs on the GPU, not the CPU), while we will primarily be using the Qt5 classes QVector3D and QMatrix4x4. However, the coordinate frames, ideas, and transformations discussed are identical.
Let's try this again.
The examples repo should have two remotes. The first, origin, refers to your personal copy on the github server. The second, upstream, refers to a read-only copy that I will update throughout the semester. Let's check the status of our remotes and get some updates
$ cd ~/cs40/examples $ git remote show origin upstream
If you do not have an upstream remote, you can add it now.
git remote add upstream email@example.com:CS40-F18/examples.git git fetch upstream
$ git remote show origin X11 forwarding request failed on channel 0 * remote origin Fetch URL: firstname.lastname@example.org:CS40-F18/examples-adanner1.git Push URL: email@example.com:CS40-F18/examples-adanner1.git HEAD branch: master Remote branches: master tracked Local branches configured for 'git pull': master merges with remote master Local refs configured for 'git push': master pushes to master (up to date) $ git remote show upstream X11 forwarding request failed on channel 0 * remote origin Fetch URL: firstname.lastname@example.org:CS40-F18/examples.git Push URL: email@example.com:CS40-F18/examples.git HEAD branch: master Remote branches: master tracked $ git branch -avv master ddee7fe [origin/master] Last commit message remotes/origin/HEAD -> origin/master remotes/origin/master ddee7fe Last commit message remotes/upstream/master 19169f2 upstream commit messageTry to get the latest changes from upstream
git fetch upstream git merge upstream/master fatal: refusing to merge unrelated histories
Let's fix the issue of unrelated histories by forcing the merge, but keeping any of our local changes.
git merge -X ours --allow-unrelated-histories upstream/master
After this step, you will need to manually edit the top level
CMakeLists.txt to add the new subdirectories.
$ tail ~/cs40/examples-adanner1/CMakeLists.txt add_subdirectory(w01-intro) # add these two lines add_subdirectory(w02-opengl) add_subdirectory(w03-cube)
If everything went well, you should be able to go into your
build directory and run
make -j8 to compile the week 02 and 03 samples.
cd build make -j8 cd w03-cube ./cube
z keys allow you to rotate the cube. It's kind of hard to tell it's a 3D cube at this point. We'll be working on that in the next few weeks.
Often after a merge, git will drop you into an editor to edit the commit message. For some of you the default editor may be the dreaded
vim. To accept the default message and quit vim, type
<ESC> :wq. To change your editor, you can use
git config --global core.editor and some editor. For atom users, you can use, e.g.,
git config --global core.editor "atom --wait"