LoginSignup
3
3

More than 5 years have passed since last update.

macでGLUTを触ってみた vol.1

Posted at

環境:MacBook Air
参考サイト
http://www.wakayama-u.ac.jp/~tokoi/opengl/libglut.html#3.3

まずは、
/usr/local/includeに GLディレクトリ が必要との事。

// ディレクトリの作成
mkdir /usr/local/include/GL
// シンボリックリンク作成の為にディレクトリの移動
cd /usr/local/include/GL/
// シンボリックリンク作成
sudo ln -s /System/Library/Frameworks/GLUT.framework/Headers/glut.h .

準備が出来た所で、
一旦サンプルプログラムを作成。

#include <OpenGL/gl.h>
#include <GLUT/glut.h>

void draw(void)
{
}

int main( int argc, char* argv[] )
{
  glutInit( &argc, argv );
  glutCreateWindow( argv[0] );
}

コンパイル

gcc sample01.cpp -o sample01.out -Wall -framework GLUT -framework OpenGL
オプション 説明
-o 出力ファイル名
-Wall ワーニング(コンパイル時の警告)を全て表示する

実行

./sample01.out

sample01.png

3
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3