博文

目前显示的是 十一月, 2019的博文

Generating a QR code with Unity and ZXing(zebra crossing)

图片
Recently in a project of my internship, I need to use the unity to read a particular URL in a txt file, and generate a QR code with this URL. Reading a txt file and transfer its content into string seems easy, while I still encountered some problem. After browsed some tutorials, I know that I should save the file's path in a string, and use a StreamReader object to read the content in the file, and save them in a list of string. But found that if I use: path = "Assets/URL.txt" ; It would work in the unity editor undoubtedly, but if I build the file and run in windows OS, I found that I can not find that path anymore. Soon I found that I should build a StreamingAssets folder in the Assets Folder, and put the txt file in the new folder, use the Application.streamingAssetsPath + "file name" to access it. Each platform of builded unity exe program has unique file path, so that try to access a file with path "Assets/URL.txt" in a builded program is not...

First contact with OpenGL(1)--Windows and Triangles

图片
I'm trying to learn something about OpenGL these days, and planing to create a technical demo based on OpenGL as a part of my portfolio. I would record my learning experience here. OpenGL is a graphic API and I use it based on C++, Xcode and GLFW, GLAD, and the most important reference tutorial of my learning is the website  https://learnopengl-cn.github.io/ (Chinese version of https://learnopengl.com/ ). After configuring environment of OpenGL(actually the tutorial have just mentioned the way of configuring environment with windows OS and Visual Studio, so it really took a long time for me to find out how to do the same thing with Mac OS and Xcode), the first step of creating an OpenGL program is creating a window. We can use codes following to initiate a window in MacOS: glfwInit (); glfwWindowHint ( GLFW_CONTEXT_VERSION_MAJOR , 3 ); glfwWindowHint ( GLFW_CONTEXT_VERSION_MINOR , 3 ); glfwWindowHint ( GLFW_OPENGL_PROFILE , GLFW_OPENGL_CORE_PROFILE ); #ifdef __APPLE__...