線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1643
推到 Plurk!
推到 Facebook!

點選3D遊戲螢幕上物件的教學文章

 
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-06-13 14:21:14 IP:61.218.xxx.xxx 未訂閱
This tutorial is about OpenGL picking. A scene made from cubes and spheres is created and rotated around the y-axis. The resulting GL 'picks' are sorted on the z-axis, thus the user is always able to select the front-most object at any time.    Picking with OpenGL This tutorial goes through OpenGL's picking (selection) capabilities. The selection buffer is used to return which objects are under the mouse pointer. These objects are then sorted in z-axis order to find which one (if more than one) is nearer to the 'screen'; a wireframe is then drawn 'on top' of the selected object to identify it. This z-axis sorting is very helpful, as it allows the user to select the nearest object to him from many overlapping objects. If for example, a chair was drawn in front of a wall, and the user clicked on the chair, OpenGL would return two hits; one from the chair and one from the wall, resulting in confusion. By sorting the GL hits related to their z-axis value (returned from OpenGL's picking functionality) the application 'knows' which object is nearer to the user and thus selects it. The tutorial is divided into two parts. The first part explains the creation of two simple classes DG_Vertex and DG_Object which will be used later in the main program. The second part contains the actual program which is made to demonstrate OpenGL's picking capabilities. Creating the DG_Vertex and DG_Object classes http://www.dev-gallery.com/programming/opengl/picking/picking2.htm The main program & downloads http://www.dev-gallery.com/programming/opengl/picking/picking3.htm
系統時間:2024-04-24 21:19:20
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!