2011-12-18 4 views
0

私のコードを追加すると、基本的にはこれです:は、OpenGLのプログラムの主な機能のために、これまでにメニューバーとOpenGLアプリケーションで追加のウィンドウ

int main(int argc, char **argv) 
{ 
    glutInit(&argc, argv); // Initialize GLUT 
    glutInitDisplayMode(GLUT_SINGLE); // Set up a basic display buffer (only single buffered for now) 
    glutInitWindowSize(500, 500); // Set the width and height of the window 
    glutInitWindowPosition(100, 100); // Set the position of the window (on your screen) 
    glutCreateWindow("Statistical Mechanics Simulation"); // Set the title for the window 
    glutDisplayFunc(display); // Tell GLUT to use the method "display" for rendering 
    glutReshapeFunc(reshape); // Tell GLUT to use the method "reshape" for rendering 
    glutIdleFunc(simulate); 

    containers.push_back(Container(Coordinate(-50, -50, -50), Coordinate(100, 100, 50))); 
    containers[0].addParticle(Particle(1, 5, Coordinate(30, 30, 0), Coordinate(5, 3, 0))); 
    containers[0].addParticle(Particle(4, 2, Coordinate(-10, 20, 0), Coordinate(0, 0, 0))); 
    containers[0].addParticle(Particle(5, 5, Coordinate(0, 0, 0), Coordinate(50, 0, 0))); 

    glutMainLoop(); // Enter GLUT's main loop 

    return 0; 
} 

本のOpenGLの最上部にメニューバーを追加するための最良の方法だろう何ウィンドウは、通常のWindowsアプリケーションのように機能します。他のウィンドウとパネルの追加はどうですか?

答えて

3

OpenGLは単なる描画APIです。トップレベルウィンドウを作成することは、そのスコープの外にあります。 OpenGLでGUIツールキットを実装することは完全に可能です。しかし、あなたはQtやGTKのような本当のツールキットを使う方が良いと思います。

これまでOpenGLの一部ではないGLUT、を使用しています。小規模でシンプルなサンプルプログラムを対象とした第三者図書館です。あなたはそれを強制することはありません。

+0

ああ、明確化のおかげで!私は次に考えてGtkを試してみる – wrongusername

1

OpenGLハードコアを使用している場合は、Clutterを参照してください。 OpenGLベースのウィジェットを提供するライブラリです。

+0

情報ありがとう! 「ハードコア」とはどういう意味ですか? – wrongusername

+0

@wrongusername非OpenGLウィンドウとウィジェットを除外します。 – casualcoder

関連する問題