1 / 12

Chap 05 3D

Chap 05 3D. The Programmer ’ s Interface. OpenGL(Open Graphics Library) Cross-platform Windows Unix/Linux Mac Java SGI, 1992 Professional graphics http://www.opengl.org. The Programmer ’ s Interface. DirectX Windows-platform / XBOX Microsoft, 1995 Computer Game 前身為 WinG

tamika
Download Presentation

Chap 05 3D

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. Chap 05 3D

  2. The Programmer’s Interface • OpenGL(Open Graphics Library) • Cross-platform • Windows • Unix/Linux • Mac • Java • SGI, 1992 • Professional graphics • http://www.opengl.org

  3. The Programmer’s Interface • DirectX • Windows-platform / XBOX • Microsoft, 1995 • Computer Game • 前身為WinG • 較為常見的版本為DX3(support 3D), DX6, DX9

  4. OpenGL The Programmer’s Interface • Library • DirectGraphic(Direct3D & DirectDraw) • DirectPlay • DirectSound • DirectInput • http://www.microsoft.com/windows/directx

  5. JOGL 注意:外部Library import processing.opengl.*; • Java OpenGL • https://jogl.dev.java.net/

  6. 3D的座標系統 size(X, Y, P3D) / size(X, Y, OPENGL) X軸 (0,0) Z軸 <想想看> 沒指定Z的範圍 Y軸 <想想看> P3D和OPENGL差別 (X, Y)

  7. size(Width, Height, P3D); • translate(X, Y, Z) -位移 • 請畫出右邊的場景 • rotateX(Num), rotateY(Num), rotateZ(Num) -旋轉, Num為弧度 • pushMatrix() 、popMatrix() • lights() -光源

  8. 2D指令 • sphere(Radius) • box(Length, Width, Height)

  9. size(320,200,P3D); noStroke(); lights(); pushMatrix(); translate(160,100); fill(255,0,0); sphere(40); popMatrix(); pushMatrix(); translate(100,100); rotateX(0.6); fill(0,255,0); box(20,20,30); popMatrix();

  10. translate,rotate先後順序有差嗎 <試試看> 自轉 vs 公轉

  11. import processing.opengl.*; float boxr; void setup() { size(320,200,P3D); noStroke(); boxr=0; } void draw() { background(0); lights(); pushMatrix(); translate(160,100); fill(255,0,0); sphere(20); translate(40,0); rotateY(boxr); fill(0,255,0); box(10,10,10); popMatrix(); boxr+=0.01; }

  12. 課堂作業 • 地球繞太陽,月亮繞地球

More Related