1 / 17

中学生のための体験講座 グラフィックスプログラミング

中学生のための体験講座 グラフィックスプログラミング. 1,2 August 2003. 情報工学科 小坂敏文. 最初のプログラムの実行手順(1). 作業: 「 step0.cpp」 を「 GLcc.cmd」 にドラッグ&ドロップ. 最初のプログラムの実行手順(2). 「 step0.exe」 をダブルクリック. 最初のプログラムの実行の様子. ウインドウ内部で ドラッグしてみよう. 元のプログラムを確認しよう. 作業: 「 step0.cpp」 を「 TeraPad」 にドラッグ&ドロップ. 元のプログラム( step0.cpp).

decima
Download Presentation

中学生のための体験講座 グラフィックスプログラミング

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 中学生のための体験講座 グラフィックスプログラミング 1,2 August 2003 情報工学科小坂敏文

  2. 最初のプログラムの実行手順(1) 作業:「step0.cpp」を「GLcc.cmd」にドラッグ&ドロップ

  3. 最初のプログラムの実行手順(2) 「step0.exe」をダブルクリック

  4. 最初のプログラムの実行の様子 ウインドウ内部でドラッグしてみよう

  5. 元のプログラムを確認しよう 作業:「step0.cpp」を「TeraPad」にドラッグ&ドロップ

  6. 元のプログラム(step0.cpp) // step0 for unior high school students // T. Kosaka CS TNCT 30Apr2003 #include <stdio.h> #include <math.h> #include <GL/glut.h> #include "GL_CG_Juniorhigh.h" void userdraw(void) { static int tick=0; fillRectangle(-180,100,200,-100,RGB(0,0.5,0.5)); drawRectangle(-200,100,-150,-150,RGB(0,0,0.8)); fillEllipse(-100,120,100,-200,RGB(0.2,0.8,0.2)); drawEllipse(-50,-50,200,-180,RGB(1,0,0)); drawLine(-40,-40,100,160,RGB(0.8,0,0)); tick++; } 「//」で始まる部分はコメントであり,何を書いてもよい この部分は,まだ理解しなくてよい。高専4年生くらいに理解します。 ここがこのプログラムの重要部分

  7. xy座標平面 y y (50,100) x x (-50,-80)

  8. fillRectangle(-180,100, 200,-100, RGB(0,0.5,0.5)); drawRectangle(-200,100, -150,-150, RGB(0,0,0.8)); fillEllipse(-100,120, 100,-200, RGB(0.2,0.8,0.2)); drawEllipse(-50,-50, 200,-180, RGB(1,0,0)); drawLine(-40,-40, 100,160,RGB(0.8,0,0)); (-180,100) y x (200,-100) (200,-180) (-50,-50) プログラムと図形の関係

  9. フィンランドの国旗(Finland.cpp)

  10. フィンランドの国旗のプログラム fillRectangle(-150,100,150,-100,RGB(1,1,1));     fillRectangle(-150, 20,150, -20,RGB(0.3,0.5,1));         fillRectangle(-70,100,-30,-100,RGB(0.3,0.5,1));

  11. オーストリアの国旗(Austria.cpp)

  12. フランスの国旗(France.cpp)

  13. アヒル(gagah.cpp)

  14. 動くアヒル(movegagah.cpp)

  15. 回るアヒル(rotategagah.cpp)

  16. ドラえもん(draemon.cpp) 配布されたプログラム 完成させよう

  17. グラデーションをつけた四角形(step1.cpp)

More Related