作者smartjay (高毛毛)
看板C_and_CPP
標題[問題] openGL旋轉及移動至定位
時間Thu Apr 3 11:25:37 2014
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Code Block
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
OpenGL
問題(Question):
小弟將滑鼠坐標轉換到可視範圍
glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
而視窗大小為500*500
餵入的資料(Input):
滑鼠點擊位置
預期的正確結果(Expected Output):
希望我點擊之後,橢圓的中心可以隨著我算出的單位向量移動至滑鼠
位置
錯誤結果(Wrong Output):
物體亂飛,無法到我滑鼠正確指定位置
程式碼(Code):(請善用置底文網頁, 記得排版)
http://codepad.org/lnlFdP8X
補充說明(Supplement):
MouseToWindow()將滑鼠坐標轉換至視窗大小及可視範圍正確比例
MoveVectot()取得移動向量
getcir()先繪製一橢圓
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.254.108.159
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1396495542.A.F56.html
→ smartjay:請板上的朋友建議我該如何解決,謝謝 04/03 11:37
→ smartjay:已經使用將視窗大小與圖框大小相同減少麻煩完成。 04/08 14:17
推 longlongint:除以500再乘以20再減10 04/17 09:22
→ longlongint:然後注意一下y的方向 04/17 10:02