LoginSignup
27
29

More than 5 years have passed since last update.

OpenGL + GLUT 入門メモ

Posted at

環境は Mac OS X 10.9.2

OpenGL,GLUTのインストール

Mac OS X は 開発に必要なライブラリ等は Developer Tool に入っているのでダウンロードなどは不要。

HelloWorld

hello.c
#include <GLUT/glut.h>

// ウィンドウへの描画関数
void display(void)
{
}

int main(int argc, char *argv[])
{
  // OpenGL/GLUT 環境の初期化
  glutInit(&argc, argv);
  // ウィンドウを開く
  glutCreateWindow("Hello OpenGL/GLUT world.");
  // ウィンドウへの描画関数の登録
  glutDisplayFunc(display);
  // メインループ開始
  glutMainLoop();
  return 0;
}

コンパイル

cc hello.c -framework GLUT -framework OpenGL

Mervericks だと大量のDeprecation warring が出るので -Wno-deprecated をつける

cc hello.c -framework GLUT -framework OpenGL -Wno-deprecated
27
29
0

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
27
29