0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

在 Mac 用 GLUT 建立一個視窗

Posted at
main.cpp
# include <iostream>
# include <OpenGL/OpenGL.h>
# include <GLUT/GLUT.h>

void draw(void) {
    glFlush();
}

int main(int argc, char * argv[]) {
    glutInit(&argc, argv);
    glutInitWindowSize(600,600);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA | GLUT_DEPTH);
    glutCreateWindow("Title");
    glutDisplayFunc(draw);
    glutMainLoop();
    return 0;
}

Compile

Terminal 指令

gcc -framework GLUT -framework OpenGL main.cpp

預設會產生一個 a.out 檔案

Execute

在 Terminal 這樣執行就會開啟一個最基本的視窗

./a.out
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?