Coder Social home page Coder Social logo

suisui-daigaku / notesforgraphics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lumixraku/notesforgraphics

0.0 0.0 0.0 443.64 MB

现代图形学入门笔记

Shell 0.01% JavaScript 0.43% C++ 5.54% C 69.71% Objective-C 1.17% M 0.11% CSS 0.34% Makefile 0.16% HTML 21.58% CMake 0.84% Less 0.10%

notesforgraphics's Introduction

NotesForGraphics

主办方主页 课程主页 PPT Assignments

Codes forked from https://github.com/kingiluob/Games101

Prepare for task env

brew install eigen

brew install opencv@2

brew tap brewsci/science

brew install pkg-config

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/

ln -s /usr/local/Cellar/opencv@2/2.4.13.7_7/lib/pkgconfig/opencv.pc $PKG_CONFIG_PATH

After everything have done , when you run this command pkg-config --cflags --libs opencv will see this:

-I/usr/local/Cellar/opencv@2/2.4.13.7_7/include/opencv -I/usr/local/Cellar/opencv@2/2.4.13.7_7/include -L/usr/local/Cellar/opencv@2/2.4.13.7_7/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab

I'm using Xcode as my C++ IDE, create a command line Project for Task1.

Add this to your project.

Add following to Build Settings ---> Header Search Paths (Eigen requires the first dependency.)

/usr/local/include
/usr/local/Cellar/opencv@2/2.4.13.7_7/include

PS 直接双击 Header Search Paths 后面的空白区域填写, 会有一个弹窗然后点+号开始写 不用单独写下面的 Debug 和 release

And make it no-recursive. (Though medium blog says this should set recursive, I found if set recursive would cause fatal error when building)

Then add this to library search path.

/usr/local/Cellar/opencv@2/2.4.13.7_7/lib

Add pkg-config --cflags --libs opencv output to Other Linker Flags

-I/usr/local/Cellar/opencv@2/2.4.13.7_7/include/opencv -I/usr/local/Cellar/opencv@2/2.4.13.7_7/include -L/usr/local/Cellar/opencv@2/2.4.13.7_7/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab

TroubleShotting

install opecv2

https://www.learnopencv.com/install-opencv3-on-macos/

https://medium.com/beesightsoft/macos-mojave-10-14-3-setup-environment-for-opencv4-0-1-c-develop-fcae955d6b33

install eigen for mac

https://stackoverflow.com/questions/35658420/installing-eigen-on-mac-os-x-for-xcode

Undefined symbols for architecture x86_64: error

https://stackoverflow.com/questions/24985713/opencv-undefined-symbols-for-architecture-x86-64-error

xcode No member named 'FILE' in the global namespace

https://stackoverflow.com/questions/30638320/xcode-cstdlib-no-member-named-xxx-in-the-global-namespace

for task2

Implicit instantiation of undefined template 'std::__1::array<Eigen::Matrix<float, 4, 1, 0, 4, 1>, 3>'

Add #include <array> in rasterizer.cpp

for task3

You should use C++ 17

Set C++ Language Dialect to C++ 17 [std=C++17]

Set C++ Standard Library to ... LLVM C++ ...

read file

Another thing you have to know is Xcode not running your CPP code in your work directory, but a very deep path like ~/Library/Developer/Xcode/DerivedData/task3-ewyxlatyzwtvlgcrtquhcxutpryf/Build/Products/Debug

you can find this path under `File explorer --->  Products` then right click  your app `Show in finder`

So, if you want to read file, you have to copy your file to certain path.

check this https://mmquant.net/working-directories-and-build-locations-with-xcode9-and-cpp/

I am now using option2 for task3.

In TARGETS ---> Build Phases, Set Copy Files ---> Destination to Products Directory

and set subpath to empty. Click + to choose your models folder.

After you click running, you will see models copied into ~/Library/Developer/Xcode/DerivedData/task3-ewyxlatyzwtvlgcrtquhcxutpryf/Build/Products/Debug

run with arguments

Product ---> Scheme ---> Edit Scheme

First argument is output.png. Second argument is texture or phone or normal ..

for task5 6

No template named 'optional' in namespace 'std'

Set C++ Language Dialect to C++ 17 [std=C++17]

Set C++ Standard Library to ... LLVM C++ ...

for task 7

omp.h

brew install libomp

/usr/local/Cellar/libomp/10.0.0/include

https://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x

for task8

ft2build.h' file not found. Mac

https://stackoverflow.com/questions/16826069/osx-10-7-5-fatal-error-ft2build-h-file-not-found

brew install freetype

notesforgraphics's People

Contributors

lumixraku avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.