import Graphics ; import Graphics3D ; import GUI ; // グラフィックスデータと3DCGレンダラーの生成 int graphicsID = newGraphics( ) ; int rendererID = newGraphics3DRenderer( 800, 600, graphicsID ) ; // 表示画面の生成 int windowID = newWindow( 0, 0, 800, 600, " Hello 3DCG ! " ); int labelID = newImageLabel( 0, 0, 800, 600, graphicsID ) ; mountComponent( labelID, windowID ); // マウス操作で視点を操作できるようにする setGraphics3DDefaultEventHandler( rendererID, labelID ) ; // 背景色を黒に設定 setGraphics3DColor( rendererID, 0, 0, 0, 255 ) ; //座標軸モデルを生成して配置 int axis = newAxisModel( 3.0, 3.0, 3.0 ) ; mountModel( axis, rendererID ) ; // アニメーション処理 bool mainLoopState = true ; while( mainLoopState ){ sleep( 30 ) ; // 30ミリ秒だけ停止 paintGraphics3D( rendererID ) ; // 3DCGを描画 paintComponent( labelID ) ; // GUIの再描画 paintComponent( windowID ) ; // GUIの再描画 } exit(); // ループを脱出するとプログラムを終了 // ウィンドウを閉じた際に呼び出される void onWindowClose( int id ){ mainLoopState = false ; //ループを脱出 }