Setup OpenGL Environment on Xcode

Posted in OpenGL, Tips

Preparing Libraries:

Since most of the libraries provide cmake files to generate files, it is better to have a CMake on your Mac. I do not know a lot about CMake. I just explain how to install it.

For convenience, I installed CMake by Homebrew. Here is the link for installing Homebrew:
After installing Homebrew, just type “brew install cmake” command in Terminal and CMake will be installed.

1. Go to website and download the file:
2. Unzip the downloaded file.
3. Open Terminal and go to the root directory of glfw, like “glfw-3.2”.
4. Type commands:
cmake .
sudo make install
It means GLFW is successfully installed.

1. Go to website and download the file:
2. Open Terminal and go to the root directory of glew, like “glfw-3.1.2”.
3. Type commands:
make install
make clean
You may have problem like “no permission”. Because users do not have the permission to directly modify the folder /usr/local/include and /usr/local/lib. You may use command in Terminal to get the permission if you like to install in these folders. Otherwise you can modify the Makefile so that it will generate into different folder. The commands to get the permission are
sudo chown -R $(whoami) /usr/local/include/GL
sudo chown -R $(whoami) /usr/local/lib

What’s more, you can also install glew by Homebrew.

Continue reading

2D Graphics with OpenGL by Examples

Posted in OpenGL

OpenGL là giao diện phần mềm hướng thủ tục theo chuẩn công nghiệp hỗ trợ đồ hoạ 3 chiều. Được phát triển đầu tiên bởi Silicon Graphic Inc,bao gồm khoảng 250 câu lệnh được hỗ trợ bởi nhiều ngôn ngữ như C, C++,Java. Cho phép người lập trình sử dụng tạo ra các đối tượng đồ họa. OpenGL được thiết kế không phụ thuộc vào nền tảng phần cứng cũng như hệ điều hành máy tính (independence of hardware platform and operating system). Continue reading