Git Product home page Git Product logo

opengl_1's Introduction

opengl_1

旋轉圓形和狒狒

作業環境:Windows10 64bit

編輯器:Visual Studio 2019

語言:C++

套件:OpenGL、Freeglut(引用自NuGet nupengl.core)

作業要求: 1.繪製一個多邊形:

-由多個內接的三角形拼接而成

-使用灰色著色:最淺色及最深色部分彼此相對,以漸層的方式呈現出來(白~灰~黑)

2.給多邊形,至少設置3種功能按鈕:

-Quit:退出程式

-Sides:可以給圖中 的多邊形,調整邊數,選項至少有8、16、32、64和128邊,邊數越多同樣需有漸層的效果

-Speed:可以使圖中的多邊形旋轉,至少要設置6種旋轉速度(逆時針或順時針旋轉不限)

3.將狒狒放到介面上,並旋轉90度

bonus:

1.能改變多邊形顏色的選單功能

(紅、綠、藍、黑)

-在switch中改變全域中顏色顯示的變數(isR、isG、isB),為1時表示顯示,為0時不顯示。

-在繪製時將顏色顯示變數乘上計算好的RGB值

-glColor3f(colorisR, colorisG, color*isB);

2.能改變多邊形旋轉方向的選單功能

(開始、停止、順時針、逆時針)

-開始、停止:在switch中改變全域中判斷旋轉的變數(isRotate),為1時旋轉,為0時不旋轉。

-在改變角度的Idle Function中,若isRotate為1,角度+2,若isRotate為0,角度為0

-順時針、逆時針:在switch中改變全域中判斷轉向的變數(rotate),為-1時順時針,為1時逆時針。

-在繪製多邊形的Function中呼叫旋轉函式

-glRotatef(spin, 0, 0, rotate);

3.能調整狒狒圖片角度的選單功能

(正常、順時針轉90度、逆時針轉90度、上下顛倒)

-在switch中改變全域中中判斷bmp旋轉的變數(bmpRotate)並重新繪製,為0時表示正常,為1時順時針,為-1時逆時針,為2時上下顛倒。

-在逐點繪製Bitmap的function中,依據bmpRotate選擇對應的繪製方式

操作說明:

所有選單功能皆由彈出式選單完成,必須透過在視窗下方空白處點及右鍵呼叫。

點擊選單後,須點擊一下該子視窗,以選定顯示目標。

opengl_1's People

Contributors

vivian1357910 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.