锘??xml version="1.0" encoding="utf-8" standalone="yes"?>99精品国产在热久久婷婷,99国产精品,亚洲自拍偷拍福利http://www.shnenglu.com/acmiyou/category/10707.htmlAcmiyou/Sulingrzh-cnFri, 28 Aug 2009 09:39:21 GMTFri, 28 Aug 2009 09:39:21 GMT60OSG 瀛︿範<4> MatrixTransform 涓?PosiotionAttitudeTransformhttp://www.shnenglu.com/acmiyou/archive/2009/08/24/94292.html綾蟲父綾蟲父Mon, 24 Aug 2009 09:29:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/08/24/94292.htmlhttp://www.shnenglu.com/acmiyou/comments/94292.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/08/24/94292.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/94292.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/94292.html        涓棰楀満鏅爲,榪滀笉姝㈠彧鏈夊彾瀛愯妭鐐笹eode 鍥犳.鍦╫sg涓湁鐫涓浜涘悇縐嶅悇鏍風殑緇勮妭鐐?osg::Group.榪樻湁璁稿浠巓sg::Group 緇ф壙鐨勫叾浠栧悇縐嶅悇鏍風殑緇勮妭鐐?綾誨お澶氫簡.闄勭被緇ф壙鍥懼湴鍧

       鎴戠洰鍓嶅彧鏄皾璇曚嬌鐢ㄤ簡MatrixTransform PositionAttitudeTransform Group Projection Switch 絳夊悇縐嶅姛鑳界殑緇勮妭鐐?  鍦ㄤ粙緇峂atrixTransform 鍜?PositionAttitudeTransform 鑺傜偣鍓?鎴戞兂鍏堜粙緇嶄笅osg褰撲腑鐭╅樀鐨勪竴浜涚浉鍏崇煡璇? 

       鍏跺疄,鏃犻渶鍏沖績osg鐭╅樀鏄浣曞疄鐜扮殑.浣嗘槸瑕佽浣忕殑鏄痮sg涓噰鐢ㄧ殑宸︿箻鎿嶄綔,鎴戜滑騫蟲椂閲岃璁虹殑鎿嶄綔濡傛棆杞鉤縐葷瓑.
      OpenGL鐨?    newpos = R* T * oldpos    //鍏堟墽琛屽鉤縐?鍚庢墽琛?鏃嬭漿 (鍏ㄥ眬鍧愭爣緋?
      osg褰撲腑:  newpos  =oldpos * T *R    //鍏堟墽琛屽鉤縐?鍚庢墽琛屾棆杞?nbsp;   (鍏ㄥ眬鍧愭爣緋?
鍥犱負鍦╫sg褰撲腑鐭╅樀鎵ц鐨勬搷浣滃垯鏄鐭╅樀鎿嶄綔.鍥犳涓轟簡璺烵penGL鐨勫垪鐭╅樀鍋氬悓姝?鑰屼笉鍦ㄥ畾涔夌殑鏃跺欏氨鐩稿綋浜庡仛浜嗕竴涓漿緗搷浣?鍗?br> 

鍥犳鍦╫sg/State 涓?鍦ㄤ嬌鐢╝pplyModelViewMatrix()   osg/State 鏄疧penGL鐘舵佹満鐨勫皝瑁?鏄笌OpenGL浜や簰鐨勭被
Matrix

瀹冩槸鐩存帴浣跨敤glLoadMatrix(matrix)榪涜杞藉叆鐭╅樀鐨?鍥犳瀹冪殑杞疆鍒氬ソ閫傚簲浜哋penGL鍒椾紭鍏堢殑妯″紡.

浣犲彧闇鐗㈣ 鍦∣SG褰撲腑鍙樻崲鐨勬楠ゅ垯鏄乏涔樻搷浣?鍏ㄥ眬鍧愭爣緋?..鍗沖乏杈圭殑鏄厛鎵ц鍙樻崲鐨?

璋堝畬濡備笂鐨勯偅浜涗箣鍚?鎴戜滑鐜板湪鏉ョ湅MatrixTransform 鍜孭ositionAttitudeTransform.

鍙傝冨潗鏍囩郴鏈変笁縐?br>            RELATIVE_RF,    //鍏ㄥ眬 鐩稿 ()
            ABSOLUTE_RF,  //灞閮?nbsp; 緇濆 ()
            ABSOLUTE_RF_INHERIT_VIEWPOINT   //鍩轟簬瑙嗙偣涓涓眬閮ㄥ潗鏍囩郴.寰堝皯鐢ㄥ埌.

MatrixTransform 鏁呭悕 鐭╅樀鍙樻崲鑺傜偣.鍦ㄤ綅浜庡畠鐨勮妭鐐逛箣涓嬬殑鑺傜偣閮藉皢鎸夌収榪欏畠鐨勭煩闃靛彉鎹㈡潵榪涜妯″瀷鍙樻崲鎿嶄綔.鍥犳 MatrixTransform鐨勪富瑕佸姛鑳戒箣涓灝辨槸鎻愪緵妯″瀷鍙樻崲鎿嶄綔..浣犲彧瑕佹牴鎹綘鎵闇瑕佺殑璁劇疆鍏舵ā鍨嬬煩闃靛氨琛?
鍗蟲墽琛?setMatrix() 鍥犳.鏌ョ湅璁$畻褰撳墠World鐭╅樀鐨勬柟娉曞氨鍙互寰堟竻鏅扮殑鏄庣櫧鍏舵渶鍚庣粨鏋滃氨鏄?

濡傛灉鏄浉瀵圭殑.閭d箞 鍏堟墽琛岃嚜韜殑鍙樻崲,鍦ㄦ墽琛岀埗鑺傜偣鐨勫彉鎹㈡搷浣?榪欑被浼糘penGL涓悗鍐欑殑鍙樻崲鏄厛鎵ц鐨勪竴鏍?鍏ㄥ眬鍧愭爣緋昏冭檻)
鍚﹀垯鏄粷瀵圭殑,閭d箞褰撳墠鐭╅樀灝辨槸鑷韓鐭╅樀
MatrixTransform

PositionAttibuteTransform 灝辨槸浣嶇疆濮挎佽妭鐐?.鍗蟲垜浠彧鍙互璋冩暣璇ヨ妭鐐圭殑鎵鏈夊瀛愮殑浣嶇疆浠ュ強濮挎?,鎴戜滑涔熷厛鏉ョ湅涓涓嬪畠鐨勭煩闃靛彉鎹?
Positon

PositionAttibuteTransform 鐨勭煩闃靛彉鎹㈤『搴忕殑鍥哄畾鐨?鍙互璇存槸MatrixTransform鐨勪竴涓壒渚?,鎿嶄綔欏哄簭鎴戝氨涓嶅湪璇﹁皥浜?鍥犱負瀹冪殑鍔熻兘灝辨槸涓轟簡瀹炵幇濮挎佸拰浣嶇疆.榪樻湁緙╂斁絳?
鍥犳 setPivotPoint 灝嗕嬌寰椾箣鍚庣殑鍙樻崲灝嗕細鍩轟簬姝ゅ鉤縐繪搷浣滄墽琛?  

閭d箞瀹炵幇涓涓緥瀛愭潵瑙傚療浠栦滑鐨勬晥鏋? 涓嬮潰鐨勪緥瀛愬垯鏄?br><1> 浣跨敤PositionAttitudeTransform 璁劇疆宸﹁竟鐨勭墰. 浣嶇疆浣嶄簬(-10,0,0) 濮挎佷負緇晍杞存棆杞?0搴?
<2> 浣跨敤MatrixTransform 璁劇疆鍙寵竟鐨勭墰,  鍏堟墽琛屽鉤縐繪搷浣?10,0,0) 鍦ㄧ粫z杞存棆杞?0搴?鍥犳浣垮緱榪欏彧鐗涘亸灞忓箷鍐呴儴涓鐐?(浣犵敾涓潗鏍囪醬 鎸夊叏灞鎬濊礬婕旂ず 鍒欏氨鐭ラ亾鐗涘湪涓婇潰浣嶇疆浜?!)

渚嬪瓙

渚嬪瓙涓嬭澆鍦板潃  :  婧愪唬鐮佷笅杞?/a>


綾蟲父 2009-08-24 17:29 鍙戣〃璇勮
]]>
OpenGL 娓叉煋綆$嚎鐞嗚http://www.shnenglu.com/acmiyou/archive/2009/08/23/94191.html綾蟲父綾蟲父Sun, 23 Aug 2009 12:23:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/08/23/94191.htmlhttp://www.shnenglu.com/acmiyou/comments/94191.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/08/23/94191.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/94191.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/94191.html         榪欏嚑澶╃◢寰湅浜嗕竴浜涘叧浜嶨LSL鐨勯《鐐圭潃鑹蹭互鍙婄墖鍏冪潃鑹茬殑涓浜涚浉鍏崇煡璇?鐩墠鏉ヨ榪樻湁涓涓潃鑹插櫒鍒欐槸Geometry_shader..鎴戠殑鏄懼崱鐢ㄤ笉浜嗚繖涓姛鑳?.褰撶劧鏈夌偣閬楁喚>_<..
         鍦ㄧ湅浜嗕竴浜涗箣鍚?澶ф浜嗚В浜嗕竴浜涘叧浜嶰penGL娓叉煋綆$嚎鐨勭煡璇?鐪嬩簡榪欎釜涔嬪悗瀵逛簬OpenGL鐨勫涔犳垜鎯沖簲褰撴槸寰堟湁甯姪.鍏充簬榪欎箞涓綃囩殑鍘熸枃鍒欐槸GLSL-LIGHTSOURCE 鏁欑▼涓涓紑綃囬儴鍒?鍘熸枃鍦板潃:
鏄嫳鏂囩殑..鎴戝湪osgchina鏁欑▼璁哄潧涓婁篃瑙佸埌榪嘑reeSouth澶х墰鐨勪腑鏂囩炕璇?.

         鍏充簬娓叉煋綆$嚎灝嗕粈涔堝憿?鏃犻潪灝辨槸鍦∣penGL鐨勭閬撳綋涓悇涓儴鍒嗙殑鍔熻兘浠ュ強濡備綍鍦ㄧ閬撳綋涓艦鎴愪簡鎴戜滑鎯寵鐨勬渶緇堢殑涓騫呭浘.(鍍忕礌).鑰岀綰垮綋涓殑鎿嶄綔鍙垎涓轟互涓嬪嚑涓儴鍒?

 闃舵1. 鎸囧畾鍑犱綍瀵硅薄.
      濡?鐐?nbsp;綰?涓夎褰?絳変竴浜涘嚑浣曞浘鍏?.OpenGL緇樺埗鍑犱綍鍥懼厓鐨勬柟娉曟湁浠ヤ笅涓夌:
      <1> 涓嬈′竴涓《鐐?鍗充嬌鐢╣lBegin()  glVertex() glEnd() 鎸囧畾鍑犱綍瀵硅薄.
      <2> 浣跨敤欏剁偣鏁扮粍..濡俫lDrawArrays.glDrawElements.絳?涓嬈℃х殑緇樺埗澶ч噺鍥懼厓.
     涓婇潰榪欎袱縐嶆ā寮忓垯鏄珛鍗蟲ā寮?鍗蟲寚瀹氬畬鍥懼厓涔嬪悗浼氳绔嬪嵆娓叉煋.鍗沖皢鎵鏈夋暟鎹彂寰娓叉煋綆$嚎鍚庣珛鍗寵娓叉煋.
      <3>鏄劇ず鍒楄〃妯″紡.瀹冨瓨鍌ㄤ簬OpenGL鏈嶅姟绔?(鎺ユ敹OpenGL鍛戒護鐨勪竴绔?) glNewList glEndList glCallList .
    
闃舵2   欏剁偣澶勭悊鎿嶄綔:

         涓嶇浠ヤ笂鐨勫嚑浣曞璞℃槸濡備綍鎸囧畾鐨?鎵鏈夌殑鍑犱綍鏁版嵁閮藉皢浼氱粡榪囪繖涓樁孌?榪欎釜闃舵璐熻矗鐨勫垯鏄愪釜欏剁偣鐨勬搷浣?
         鍦ㄨ繖涓樁孌佃兘鍋氱殑宸ヤ綔鍒欐槸:
         1. 欏剁偣鍙樻崲...鏍規嵁妯″瀷瑙嗗浘鍜屾姇褰辯煩闃靛彉鎹?br>         2. 鍏夌収璁$畻 娉曠嚎鍙樻崲(娉曠嚎鐭╅樀 鏄ā鍨嬬煩闃電殑宸︿笂瑙?*3鐨勯嗙煩闃?鍜屾硶綰胯鏍煎寲
         3. 綰圭悊鍧愭爣鍙樻崲.(綰圭悊鐭╅樀)
         4.鏉愯川鐘舵?綰圭悊鍧愭爣鐢熸垚?
         鑰屾渶閲嶈鐨勫垯鏄彉鎹互鍙婂厜鐓? 姣忎釜欏剁偣鍦ㄨ繖涓樁孌靛垎鍒槸鍗曠嫭澶勭悊鐨?
         榪欎釜闃舵鎵鎺ユ敹鍒扮殑鏁版嵁鍒欐槸姣忎釜欏剁偣鐨勫睘鎬х壒寰?.杈撳嚭鍒欐槸鍙樻崲鍚庣殑欏剁偣鏁版嵁.

闃舵3  鍥懼厓緇勮
         鍦ㄩ《鐐瑰鐞嗕箣鍚?欏剁偣鐨勫叏閮ㄥ睘鎬ч兘宸茬粡琚‘瀹?鍦ㄨ繖涓樁孌甸《鐐瑰皢浼氭牴鎹簲鐢ㄧ▼搴忛佸線鐨勫浘鍏冭鍒?
GL_POINTS GL_TRIANGLES 絳?灝嗕細琚粍瑁呮垚鍥懼厓

闃舵4 鍥懼厓澶勭悊(瑁佸壀 娑堥殣)
         <1>榪欎釜姝ラ絎竴涓墍鍋氱殑搴斿綋鏄鍓搷浣?.浼氬皢鍥懼厓涓庣敤鎴峰畾涔夌殑瑁佸壀騫抽潰 鍗砱lClipPlane 鍜屾ā鍨嬫姇褰辯煩闃墊墍寤虹珛鐨勮鏅瘮杈? 榪欏皢浼氳鍓笖涓㈠純浣嶄簬瑙嗘櫙鍜岃鍓鉤闈㈠閮ㄧ殑鍥懼厓.涓嶅湪浜堜互澶勭悊.
        <2> 鍏舵.鑻ユ槸閲囩敤閫忚鎶曞獎 閭d箞.灝嗕細瀵規瘡涓《鐐圭殑x,y z鍧愭爣鍒嗗埆闄や互w.
        <3>绱ф帴鐫 鍒欐槸鐢辮鍙e彉鎹㈠皢欏剁偣鍧愭爣鍙樻崲鑷崇獥鍙e潗鏍?
        <4> 鎵ц娑堥殣鎿嶄綔

闃舵5  鏍呮牸鍖栨搷浣?/span>
        <1>鐢卞浘鍏冨鐞嗕紶閫掕繃鏉ョ殑鍥懼厓鏁版嵁.鍦ㄦ灝嗕細琚垎瑙f垚鏇村皬鐨勫崟鍏冨茍瀵瑰簲甯х紦鍐插尯鐨勫悇涓儚绱?榪欎簺鍗曞厓琚О涔嬩負 鐗囧厓. 涓涓墖鍏冨彲鑳藉寘鍚獥鍙e乏杈?娣卞害 棰滆壊 綰圭悊鍧愭爣絳夊睘鎬?
         <2> 鐗囧厓鐨勫睘鎬у垯鏄浘鍏冧笂欏剁偣鏁版嵁絳?span style="COLOR: red">緇忚繃鎻掑?/span>鑰岀‘瀹氱殑..榪欓噷鐢熸垚鐨勭墖鍏冨皢浼氬寘鍚富棰滆壊鍜屾棰滆壊.
           glShadeMode() 鍑芥暟鐨勪綔鐢ㄥ皢浼氳繖閲屼綋鐜?鍗充嬌鐢ㄦ彃鍊?騫蟲粦鐫鑹? 鎴栬呬嬌鐢ㄦ渶鍚庝竴涓《鐐歸鑹?騫抽潰鐫鑹?
         <3> 鐐瑰 綰垮.澶氳竟褰㈡ā寮?姝i潰鑳岄潰絳変竴浜涚壒寰佷篃灝嗘槸榪欓樁孌靛彂鐢熶綔鐢?
          <4> 鍙嶈蛋鏍蜂篃鏄繖涓樁孌佃搗浣滅敤.

 闃舵6 鐗囧厓澶勭悊
         <1>涓婄汗鐞?閫氳繃綰圭悊鍧愭爣鍙栧緱綰圭悊鍐呭瓨涓浉瀵瑰簲鐨勯鑹?br>         <2> 闆懼寲 閫氳繃鐗囧厓璺濈褰撳墠瑙嗙偣浣嶇疆淇敼棰滆壊.
         <3> 棰滆壊姹囨?.(榪欎釜涓庢販鍚堝畬鍏ㄤ笉鍚屾蹇?灝?綰圭悊,涓誨畾涔夌殑棰滆壊,闆懼寲鐨勯鑹?嬈¢鑹插厜鐓ч樁孌佃綆楃殑棰滆壊)姹囨諱竴璧?
       
闃舵7  閫愪釜鐗囧厓鐨勬搷浣?br>         <1> 鎵鏈夌殑涓浜涙祴璇?鍍忕礌鎵鏈夋潈 鍓垏(glScissor) Alpha嫻嬭瘯(glAlphaFunc) 妯$増嫻嬭瘯(glStencilFunc)
          娣卞害嫻嬭瘯 (glDephtFunc) 娣峰悎(glBlendFunc) 
         榪欎簺鎿嶄綔灝嗕細鏈鍚庡獎鍝嶅叾鍦ㄥ撫緙撳啿鍖虹殑棰滆壊鍊?

闃舵8  甯х紦鍐叉搷浣?/span>
        <1>榪欎釜闃舵鎵ц甯х紦鍐茬殑鍐欏叆絳夋搷浣滅瓑..鏈鍚庝駭鐢熶簡鏄劇ず鍑烘潵鐨勫儚绱?
         glColorMask glStrncilMask glDepthMask glClearDepht glClearStencil glClearColor 絳?灝嗗湪榪欎釜闃舵褰卞搷鍐欏叆鐨勫?


浠ヤ笂鍙槸璁ㄨOpenGL 鍥懼厓緇樺埗鐨勫熀鏈繃紼?閭d箞鍩轟簬鍍忕礌鍥懼儚緇樺埗.鍑犱箮褰㈠悓涔嬩笂..鍙槸鍦ㄥ厜鏍呭寲澶勭悊鍓嶇殑鎿嶄綔涓嶄竴鏍?鍗崇粡榪囧儚绱犺В鐮?鍍忕礌浼犺緭.鏍呮牸鍖?鏈鍚庡艦鎴愮墖鍏?..鐗囧厓涔嬪悗鐨勫鐞嗗畬鍏ㄤ竴鏍?.

鍥犳 鍦ㄧ潃鑹插櫒緙栫▼棰嗗煙..浣犲皢鍙疄鐜?br>    Vertex Shader 鏇挎崲 欏剁偣澶勭悊闃舵
    Fragment Shader 鏇挎崲 鐗囧厓澶勭悊闃舵
    Geometry Shader 鏇挎崲 鍥懼厓緇勮闃舵..


鍥犱負榪欎笁涓樁孌墊墍鍐沖畾閮芥槸鏈閲嶈鏁堟灉鐨勯樁孌?.瀵逛簬榪欎簺鐨勫彲緙栫▼灝嗗甫鏉ラ潪甯稿ぇ鐨勫ソ澶勪互鍙婂彲鎺у埗鐨勬覆鏌?!


綾蟲父 2009-08-23 20:23 鍙戣〃璇勮
]]>
OSG瀛︿範<3> Drawable 涓?鍑犱綍浣撳垱寤?/title><link>http://www.shnenglu.com/acmiyou/archive/2009/08/23/94182.html</link><dc:creator>綾蟲父</dc:creator><author>綾蟲父</author><pubDate>Sun, 23 Aug 2009 10:34:00 GMT</pubDate><guid>http://www.shnenglu.com/acmiyou/archive/2009/08/23/94182.html</guid><wfw:comment>http://www.shnenglu.com/acmiyou/comments/94182.html</wfw:comment><comments>http://www.shnenglu.com/acmiyou/archive/2009/08/23/94182.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/acmiyou/comments/commentRss/94182.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/acmiyou/services/trackbacks/94182.html</trackback:ping><description><![CDATA[<br>       鍦ㄧ煡閬撳浣曚嬌鐢╒iewer瑙嗘櫙鍣ㄦ潵榪涜浠跨湡寰幆涔嬪悗.鎬諱笉浼氫竴鐩村皾璇曠潃鏄劇ず涓澶存湁鐫鐞冮潰鏄犲皠鐨勭墰榪涜瑙傝祻鐫.鎬諱細鎯崇潃濡備綍鎼緩鑷繁鐨勬ā鍨?濡備綍瀹炵幇鑷繁鎵瑕佺粯鍒剁殑涓鍒?濡備綘涓鏍?鎴戜篃鎷ユ湁鐫榪欑鍐插姩.濡傚悓鎴戜竴寮濮嬪OpenGL鐨勬椂鍊?鎴戠粯鍒跺嚭絎竴涓笁瑙掑艦渚胯寰楀崄鍒嗙殑鍏村.浣嗗綋鎴戝皾璇曠敤瀹冧滑寤虹珛鍚勭濂囨殑鍥懼艦鐨勬椂鍊?灝卞儚鏄惌縐湪涓鏍?瑙夊緱鎬紓鍗?...<br>      Drawable 鏁呭悕 鍙粯鍒剁殑.. 閭d箞浠涔堟墠鏄彲緇樺埗鐨?鎴戜滑鍙互鎯寵薄.甯鎬嬌鐢ㄧ殑鐐?綰?涓夎褰?鍥涜竟褰?絳?榪欎簺灝辨槸鍙粯鍒剁殑.OpenGL澶у彲鍙兘瀹炵幇緇樺埗鏈緇堜篃鍙槸榪欎簺..<br><br>     緇忓父浣跨敤鐨勫満鏅浘鏄竴鑸兘鏄竴棰楁爲. 閭d箞鍦∣SG涔熶笉渚嬪.瀹冩槸涓棰楄妭鐐規爲.鍏舵渶鏈ⅱ鐨勮妭鐐規槸Geode.鍗沖彾瀛愯妭鐐? 涓涓狦eode鍙互鍖呭惈澶氫釜Drawable.鍥犳鍦∣SG涓垜浠兂瑕佺粯鍒惰濡備笁瑙掑艦絳?鏈緇堥渶瑕佷嬌鐢ㄧ殑鑲畾涔熸槸Geode鍙跺瓙鑺傜偣.鐒跺悗灝咲rawable鍔犲叆Geode涓?..<br><br>     osg/Drawable 鍙槸涓涓娊璞$被.閭d箞瀹炵幇瀹冪殑綾繪湁澶氬皯鍛? 榪樻槸姣旇緝澶氱殑.<br><img height=495 alt="" src="http://www.shnenglu.com/images/cppblog_com/acmiyou/osg/drawable.jpg" width=517 border=0><br><br>鑰岃繖涓棿鏈甯哥敤鐨勮帿灞濭eometry.鍑犱綍浣撶粯鍒?.鑰岃鍒板嚑浣曚綋.闇瑕佺殑鏃犻潪鏄偣..棰滆壊.浠ュ強濡備綍緇勬垚鍥懼厓<Primitive>..<br>      鍥犳涓涓狦eometry闇瑕佹嫢鏈夌殑鏁版嵁澶у彲鏈夌偣.娉曠嚎鍧愭爣 綰圭悊鍧愭爣.绱㈠紩鍊?..浠ュ強PrimitiveSet.<br>      鐐?娉曠嚎,棰滆壊絳?闇瑕佺敤鍒扮煝閲?鍗?osg::Vec2 osg::Vec3 osg::Vec4<br>      PrimitiveSet.鍒欏寘鍚簡緇勬垚濡備綍緇勬垚涓涓浘鍏冪殑瑙勫垯..濡侴L_POINT GL_TRIANGLES.絳?<br>      鐢ㄥ疄渚嬭鏄庡惂.濡備嬌鐢ㄤ笅闈㈣繖孌典唬鐮佸皢浼氬垱寤轟竴涓褰╃殑涓夎褰?鍜屼竴涓櫧鑹茬殑绔嬫柟浣?<br>     <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id=Code_Closed_Image_182415 onclick="this.style.display='none'; Code_Closed_Text_182415.style.display='none'; Code_Open_Image_182415.style.display='inline'; Code_Open_Text_182415.style.display='inline';" height=16 src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" width=11 align=top><img id=Code_Open_Image_182415 style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text_182415.style.display='none'; Code_Closed_Image_182415.style.display='inline'; Code_Closed_Text_182415.style.display='inline';" height=16 src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><span id=Code_Closed_Text_182415 style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Geode</span><span id=Code_Open_Text_182415 style="DISPLAY: none"><br><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">osg::Node</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> create()<br><img id=Codehighlighter1_20_1396_Open_Image onclick="this.style.display='none'; Codehighlighter1_20_1396_Open_Text.style.display='none'; Codehighlighter1_20_1396_Closed_Image.style.display='inline'; Codehighlighter1_20_1396_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_20_1396_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_20_1396_Closed_Text.style.display='none'; Codehighlighter1_20_1396_Open_Image.style.display='inline'; Codehighlighter1_20_1396_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_20_1396_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_20_1396_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_23_86_Open_Image onclick="this.style.display='none'; Codehighlighter1_23_86_Open_Text.style.display='none'; Codehighlighter1_23_86_Closed_Image.style.display='inline'; Codehighlighter1_23_86_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_23_86_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_23_86_Closed_Text.style.display='none'; Codehighlighter1_23_86_Open_Image.style.display='inline'; Codehighlighter1_23_86_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_23_86_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_23_86_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        geode is a leaf node,It must contain some drawables..<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    </span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::Geode</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> geode </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::Geode;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_127_170_Open_Image onclick="this.style.display='none'; Codehighlighter1_127_170_Open_Text.style.display='none'; Codehighlighter1_127_170_Closed_Image.style.display='inline'; Codehighlighter1_127_170_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_127_170_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_127_170_Closed_Text.style.display='none'; Codehighlighter1_127_170_Open_Image.style.display='inline'; Codehighlighter1_127_170_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_127_170_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_127_170_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* define a Geometry for draw a triangle.</span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::Geometry</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> triangle </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::Geometry;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    geode</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">addDrawable(triangle);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_251_273_Open_Image onclick="this.style.display='none'; Codehighlighter1_251_273_Open_Text.style.display='none'; Codehighlighter1_251_273_Closed_Image.style.display='inline'; Codehighlighter1_251_273_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_251_273_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_251_273_Closed_Text.style.display='none'; Codehighlighter1_251_273_Open_Image.style.display='inline'; Codehighlighter1_251_273_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_251_273_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_251_273_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* triangle Vertexs </span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::Vec3Array</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> Tvertex </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::Vec3Array;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    triangle</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">setVertexArray(Tvertex);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    Tvertex</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">push_back(osg::Vec3(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    Tvertex</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">push_back(osg::Vec3( </span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    Tvertex</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">push_back(osg::Vec3(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    <br><img id=Codehighlighter1_502_521_Open_Image onclick="this.style.display='none'; Codehighlighter1_502_521_Open_Text.style.display='none'; Codehighlighter1_502_521_Closed_Image.style.display='inline'; Codehighlighter1_502_521_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_502_521_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_502_521_Closed_Text.style.display='none'; Codehighlighter1_502_521_Open_Image.style.display='inline'; Codehighlighter1_502_521_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_502_521_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_502_521_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* set the color </span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::Vec3Array</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> Tcolor  </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::Vec3Array;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    triangle</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">setColorArray(Tcolor);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    triangle</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">setColorBinding(osg::Geometry::BIND_PER_VERTEX);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    Tcolor</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">push_back(osg::Vec3(</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    Tcolor</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">push_back(osg::Vec3(</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    Tcolor</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">push_back(osg::Vec3(</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_798_817_Open_Image onclick="this.style.display='none'; Codehighlighter1_798_817_Open_Text.style.display='none'; Codehighlighter1_798_817_Closed_Image.style.display='inline'; Codehighlighter1_798_817_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_798_817_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_798_817_Closed_Text.style.display='none'; Codehighlighter1_798_817_Open_Image.style.display='inline'; Codehighlighter1_798_817_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_798_817_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_798_817_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* set the normal</span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::Vec3Array</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> Tnormal </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::Vec3Array;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    Tnormal</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">push_back(osg::Vec3(</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    triangle</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">setNormalArray(Tnormal);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    triangle</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">setNormalBinding(osg::Geometry::BIND_OVERALL);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_1008_1047_Open_Image onclick="this.style.display='none'; Codehighlighter1_1008_1047_Open_Text.style.display='none'; Codehighlighter1_1008_1047_Closed_Image.style.display='inline'; Codehighlighter1_1008_1047_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1008_1047_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1008_1047_Closed_Text.style.display='none'; Codehighlighter1_1008_1047_Open_Image.style.display='inline'; Codehighlighter1_1008_1047_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_1008_1047_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_1008_1047_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* set the Primitive use GL_TRIANGLES</span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::PrimitiveSet</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> Tprimitive </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::DrawArrays(GL_TRIANGLES,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    triangle</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">addPrimitiveSet(Tprimitive);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_1164_1200_Open_Image onclick="this.style.display='none'; Codehighlighter1_1164_1200_Open_Text.style.display='none'; Codehighlighter1_1164_1200_Closed_Image.style.display='inline'; Codehighlighter1_1164_1200_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1164_1200_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1164_1200_Closed_Text.style.display='none'; Codehighlighter1_1164_1200_Open_Image.style.display='inline'; Codehighlighter1_1164_1200_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_1164_1200_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_1164_1200_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* now  define a box(center,width)</span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::Box</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> boxtest </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::Box(osg::Vec3(</span><span style="COLOR: #000000">1.5</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">),</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">);<br><img id=Codehighlighter1_1266_1292_Open_Image onclick="this.style.display='none'; Codehighlighter1_1266_1292_Open_Text.style.display='none'; Codehighlighter1_1266_1292_Closed_Image.style.display='inline'; Codehighlighter1_1266_1292_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1266_1292_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1266_1292_Closed_Text.style.display='none'; Codehighlighter1_1266_1292_Open_Image.style.display='inline'; Codehighlighter1_1266_1292_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_1266_1292_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_1266_1292_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000">* use the ShapeDrawable</span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    osg::ShapeDrawable</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> box </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> osg::ShapeDrawable(boxtest);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    geode</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">addDrawable(box);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> geode;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></span></div> <br>       榪欓噷鎴戝皢瑙i噴涓浜涗笢瑗?<br>       1.Geometry榛樿鏄嬌鐢ㄦ樉紺哄垪琛ㄦ潵緇樺埗鍥懼厓鐨?浣犲ぇ鍙鐪嬫簮鐮佹垨鏂囨。鍘諱簡瑙?浣犲彲浠ヨ緗?br>       setUseDisplayList(false) 紱佺敤瀹?鎴栬呰嫢鍦ㄧ粦瀹氭暟鎹殑鏃跺欎嬌鐢ㄤ簡BING_PER_PRIMITIVE涔熷皢浼氱鐢ㄦ樉紺哄垪琛?br>       2.ShapeDrawable 鍒欐槸鍐呯疆涓浜涘艦鐘剁殑鍥懼厓.璇稿 鍦嗘煴.鐞冧綋.鍦嗛敟絳?鑷繁瀹炵幇灝濊瘯涓涓?<br>       3.BING_PER_VERTEX 鍒欐寚鐨勬瘡涓《鐐瑰搴斾簬涓縐嶅睘鎬?濡備緥瀛愪腑鐨勯鑹?.<br>       4.BING_OVERALL 鍒欐槸鍏ㄩ儴欏剁偣浣跨敤涓鏍風殑灞炴?濡備緥瀛愪腑鐨勬硶綰?<br><br>瀹炰緥婧愪唬鐮佷笅杞?  ..<a >涓嬭澆鍦板潃<br></a><br><font color=#002c99>蹇樹簡璇存槑涓鐐?鍦∣SG褰撲腑鐨勫潗鏍囩郴鏄?z鏈濅笂.y鏈濋噷.x鏈濆彸..涓嶰penGL涓垰濂界粫x杞存棆杞簡90搴?.<br>榪樻湁涓鐐瑰垯鏄?鎴戜滑閫氬父鎯呭喌涓嬮粯璁や嬌鐢ㄨ鏅櫒鍏朵腑鐨勪竴涓叧浜庢憚鍍忔満婕父鍣ㄥ叾瀹為粯璁ゆ槸浣跨敤TrackballManipulator 鍥犳.瀹冧細灝嗚鐐逛腑蹇冩寚鍚戞暣涓満鏅殑鍖呭洿鐞冧腑蹇?..<br></font><br>鏈緇堢粨鏋滃浘:濡備笅:<br><img height=401 alt="" src="http://www.shnenglu.com/images/cppblog_com/acmiyou/osg/geometry.jpg" width=564 border=0><br><br> <img src ="http://www.shnenglu.com/acmiyou/aggbug/94182.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/acmiyou/" target="_blank">綾蟲父</a> 2009-08-23 18:34 <a href="http://www.shnenglu.com/acmiyou/archive/2009/08/23/94182.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>OSG瀛︿範<2> GraphicsContext涓庣獥鍙e緩绔?/title><link>http://www.shnenglu.com/acmiyou/archive/2009/08/22/94108.html</link><dc:creator>綾蟲父</dc:creator><author>綾蟲父</author><pubDate>Sat, 22 Aug 2009 13:21:00 GMT</pubDate><guid>http://www.shnenglu.com/acmiyou/archive/2009/08/22/94108.html</guid><wfw:comment>http://www.shnenglu.com/acmiyou/comments/94108.html</wfw:comment><comments>http://www.shnenglu.com/acmiyou/archive/2009/08/22/94108.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/acmiyou/comments/commentRss/94108.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/acmiyou/services/trackbacks/94108.html</trackback:ping><description><![CDATA[     鎽樿:        鎵璋撶殑GraphicsContext  鎴戣繖涔堢炕璇戝畠鍚?鍥懼艦璁懼涓婁笅鏂?..灝卞儚鍦ㄤ嬌鐢∣penGL鍦╳in32鐨勭獥鍙i噷緇樺埗鐨勬椂鍊?鏇句嬌鐢ㄧ殑hrc = wglCreateContext(hdc)涓鏍?鍒涘緩涓涓浘褰㈣澶囦笂涓嬫枃 ,鐒跺悗浣跨敤wglMakeCurrent(hdc,hrc)璁劇疆褰撳墠浣跨敤鐨勫浘褰㈣澶囦竴鏍?...  <a href='http://www.shnenglu.com/acmiyou/archive/2009/08/22/94108.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/acmiyou/aggbug/94108.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/acmiyou/" target="_blank">綾蟲父</a> 2009-08-22 21:21 <a href="http://www.shnenglu.com/acmiyou/archive/2009/08/22/94108.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>OSG瀛︿範<1> osg姒傝堪浠ュ強瀛︿範鏂規硶絳?/title><link>http://www.shnenglu.com/acmiyou/archive/2009/08/22/94107.html</link><dc:creator>綾蟲父</dc:creator><author>綾蟲父</author><pubDate>Sat, 22 Aug 2009 11:01:00 GMT</pubDate><guid>http://www.shnenglu.com/acmiyou/archive/2009/08/22/94107.html</guid><wfw:comment>http://www.shnenglu.com/acmiyou/comments/94107.html</wfw:comment><comments>http://www.shnenglu.com/acmiyou/archive/2009/08/22/94107.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/acmiyou/comments/commentRss/94107.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/acmiyou/services/trackbacks/94107.html</trackback:ping><description><![CDATA[<br>涓.姒傝堪.<br>     Osg 鍗砄penSceneGraph鐨勭畝縐?鏄竴嬈懼紑婧愮殑鍦烘櫙鍥懼艦搴?鍚屾椂瀹冧篃鏄法騫沖彴鐨?.Osg瀹冨熀浜庡満鏅浘鐨勬蹇?鍒╃敤浜嗚蔣浠跺紑鍙戝綋涓殑璁捐妯″紡鐨勭悊蹇?璁捐騫舵彁渚涗簡涓涓熀浜嶰penGL搴曞眰鐨勯潰鍚戝璞$殑鍥懼艦寮鍙戞鏋?.<br>     Osg鏄畬鍏ㄧ敱鏍囧噯C++鍜孫penGL鑰屽啓鐨?鍏呭垎鍒╃敤STL鍜岃璁℃ā寮忕殑鐗規?鍙互璇存槸鍏鋒湁楂樻ц兘,鍙墿灞?鍙Щ妞嶇殑鐗規?灝辯洰鍓嶆潵璁蹭技涔庢槸瓚婃潵瓚婃祦琛岃搗鏉ョ殑涓嬈鵑潪甯告鐨勫満鏅浘褰㈠簱.浠嶉渶瑕佹洿璇︾粏鐨勮В閲婃柟鍙幓瀹樻柟緗戠珯絳夋煡鐪?gt;_<..<br><br>浜?鍏充簬OSG鐨勫涔?<br>     1.鐢變簬OSG鏄紑婧愮殑,鐜板湪宸茬粡鍙戝睍鍒頒簡2.9鐗堟湰浜?浠g爜閲忎篃鏃ヨ秼閫掑鐨勮秼鍔?鑰岀己灝戝畬鍠勭殑鏂囨。.鎵浠ヨ閫氳浠g爜宸茬粡鏄歡闈炲父鐥涜嫤鐨勫涔犺繃紼?浣嗘槸榪欎緷鐒舵槸涓渶涓昏鐨勬柟寮忎箣涓.浠諱綍鐨勮В閲婁綘閮藉彲鑳藉湪浠g爜涓緱鍒拌В絳?<br>     2.鍏舵 鑻辨枃鐗堢殑瀹樻柟緗戠珯 鍜屼腑鏂囩殑瀹樻柟璁哄潧涔熸槸涓涓涔犵殑鍦版柟.鍦╫sgchina璁哄潧甯鎬細寰楀埌array鍜宖lysky涓や綅鐗堜富鐨勮緇嗚В絳斿拰寤鴻..<a title=osg鑻辨枃瀹樻柟緗戠珯 >osg鑻辨枃瀹樻柟緗戠珯</a>    <a title=osg涓浗瀹樻柟緗戠珯 >osg涓浗瀹樻柟緗戠珯</a><br>     3.閭歡鍒楄〃..鍒楄〃褰撲腑閮芥槸涓浜涘緢緇忓吀鐨勯棶棰?浣犲彲浠ラ氳繃閭璁㈤槄鏉ヨ幏寰?璇寸湡鐨?鎴戜篃娌℃庝箞緇嗙湅....鑻辨枃姘村鉤涓嶉珮>_<.鎵浠ュ憿榪樺湪鎭惰ˉ鐫鑻辮... <a title=閭歡鍒楄〃鍦板潃 >閭歡鍒楄〃鍦板潃</a><br>     4.鏈変釜闈炲父钁楀悕鐨勬暀紼?.緹庡浗嫻峰啗鍏充簬OSG鐨勬暀紼?.NPS...<a title=鏁欑▼鍦板潃 >鏁欑▼鍦板潃</a> .<br>娌℃兂鍒板眳鐒舵崲浜嗕釜鍦板潃瀹蟲垜鎵句簡鍗婂ぉ>_<..ofcourse English. 涓枃鐗堢殑璇戞枃浣犲彲浠ュ湪osgchina鐨勮鍧涢噷鎵劇殑鍒?浣嗗ソ鍍忎笉鍏ㄩ潰.<br>     5. osg婧愪唬鐮佷腑鐨勬墍鏈変緥瀛?examples...<br>     6. 鍏舵鍛?鎺屾彙涓瀹氱殑OpenGL鍩虹涔熸槸闈炲父濂界殑瀛︿範鍓嶆彁.鎴戝氨鏄繖涓や釜鍚屾椂涓璧峰鐨?gt;_<,<br>涓?鍏充簬OSG鐨勪竴浜涘唴瀹?<br>    1.絎竴涓噸鐐瑰垯鏄満鏅鐞嗙殑鑳藉姏.鍙互鐞嗚В鎴愭槸涓棰楀満鏅爲.<br>    2.osg鐨勫満鏅浘褰㈠崟綰跨▼/澶氱嚎紼?娓叉煋 (娓叉煋榪囩▼鍒嗕負:鐘舵佹爲鍜屾覆鏌撴爲)<br>    3.osg涓疄鐜板緢澶氶潪甯稿疄鐢ㄧ殑宸ュ叿鍛,妯″瀷璇誨彇絳?騫朵笉闇瑕佹垜浠嚜宸卞啓寰堝浠g爜鍘誨疄鐜拌繖鏂歸潰鐨勫唴瀹?<br>    4.osg闆嗘垚鎵鏈夌殑OpenGL鐨勭姸鎬佸拰Shader鐨勪竴浜涘唴瀹?.榪樻湁鐭╅樀榪愮畻絳?<br>   榪樻湁璁稿鍐呭鎴戝茍娌℃湁璇寸殑鍒?gt;_< 鍥犱負鎴戝彧鏄湅浜嗕竴涓湀鐨勪唬鐮佸拰璧勬枡..涔熸病鏈夊畬鏁寸殑鍐欒繃寰堝紼嬪簭.鎵浠ユ垜渚濈劧榪樺湪瀛︿範褰撲腑.>_<<br>鍩轟簬浠ヤ笂鎴戜滑鍙互璁や負.OSG鏄竴涓潪甯稿疄鐢ㄧ殑楂樺眰鍥懼艦搴旂敤.<br><br>鍏充簬1.2涓ら儴鍒嗗唴瀹逛綘鍙弬鑰?Array鐗堜富鐨勬煇綃囧ぇ浣?<鏈闀跨殑涓甯?gt; 璇﹁堪浜哋SG褰撲腑涓甯у綋涓彂鐢熺殑鎵鏈変簨鎯?.<br><br>鍏充簬絎笁.閮ㄥ垎 涓昏鐨勯泦涓?osgDB鍜宱sgUtil 榪欎袱涓簱褰撲腑.<br>鍏充簬絎洓閮ㄥ垎   OpenGL鐘舵侀泦鍚堜富瑕佹槸 osg/StateSet 鍜?osg/StateAttribute  osg/Shader  osg/Matrix絳夎澶氱被褰撲腑闆嗘垚浜?<br><br>榪欐槸鎴戠洰鍓嶆墍鑳借鏄庣殑涓浜?gt;_< 姣曠珶鎴戜篃鍙槸鍒濆鑰?.<br>鎴戜細灝嗚繖浜涘ぉ浠ユ潵鐨勫涔犱互鍙婁唬鐮佺殑闃呰榪囩▼涓竴浜涙葷粨鐢氳嚦浣撲細鍐欎笅鏉?..<br> <img src ="http://www.shnenglu.com/acmiyou/aggbug/94107.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/acmiyou/" target="_blank">綾蟲父</a> 2009-08-22 19:01 <a href="http://www.shnenglu.com/acmiyou/archive/2009/08/22/94107.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>opengl nehe lesson 1-24璇?glut鐗堟湰浠g爜http://www.shnenglu.com/acmiyou/archive/2009/08/21/94019.html綾蟲父綾蟲父Fri, 21 Aug 2009 06:09:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/08/21/94019.htmlhttp://www.shnenglu.com/acmiyou/comments/94019.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/08/21/94019.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/94019.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/94019.html鎴戝彂鐜版垜鑷繁閮芥病絀轟竴綃囦竴綃囩殑鍐欑潃鍙戠潃鎬葷粨浜?鏈榪戝彲鑳芥湁鐐瑰繖..鎴戞槸涓杈瑰opengl,涓杈瑰鐫涓涓紑婧愮殑鍥懼艦娓叉煋寮曟搸osg.  鑰佸笀鍙﹀榪樺彨鎴戠湅鐪婫LSL ..鎴戝彂鐜伴兘蹇繖涓嶈繃鏉ヤ簡>_< 榪樻湁瀹夋帓鏃墮棿瀛︿範鑻辮,浠ュ強璁捐妯″紡涔嬪鐨勪竴浜涚煡璇嗙瓑..浜嬫儏鐪熷.瀛︽棤姝㈠鍛?.

闄勪笂鏈榪戝NEHE 鍐欑殑1-24鐨勪唬鐮?gt;_<    鍐呴儴娉ㄦ湁璇︾粏娉ㄩ噴,濡傛湁浜涘嚱鏁板姛鑳藉彲璇︾湅opengl鏂囨。鍚?nbsp; :涓嬭澆鍦板潃 




綾蟲父 2009-08-21 14:09 鍙戣〃璇勮
]]>
opengl瀛︿範 nehe opengl lesson_9http://www.shnenglu.com/acmiyou/archive/2009/08/08/92629.html綾蟲父綾蟲父Sat, 08 Aug 2009 09:48:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/08/08/92629.htmlhttp://www.shnenglu.com/acmiyou/comments/92629.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/08/08/92629.html#Feedback1http://www.shnenglu.com/acmiyou/comments/commentRss/92629.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/92629.html闃呰鍏ㄦ枃

綾蟲父 2009-08-08 17:48 鍙戣〃璇勮
]]>
opengl瀛︿範 nehe lesson 8http://www.shnenglu.com/acmiyou/archive/2009/08/08/92627.html綾蟲父綾蟲父Sat, 08 Aug 2009 09:14:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/08/08/92627.htmlhttp://www.shnenglu.com/acmiyou/comments/92627.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/08/08/92627.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/92627.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/92627.html闃呰鍏ㄦ枃

綾蟲父 2009-08-08 17:14 鍙戣〃璇勮
]]>
OSG 紕版挒媯嫻嬩箣澶氶潰浣撴眰浜ゅ櫒浠g爜瑙h(PloytopeIntersector)http://www.shnenglu.com/acmiyou/archive/2009/08/02/91942.html綾蟲父綾蟲父Sun, 02 Aug 2009 07:03:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/08/02/91942.htmlhttp://www.shnenglu.com/acmiyou/comments/91942.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/08/02/91942.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/91942.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/91942.html闃呰鍏ㄦ枃

綾蟲父 2009-08-02 15:03 鍙戣〃璇勮
]]>
opengl 浣跨敤bmp浣嶅浘綰圭悊(8-bit 24bit)http://www.shnenglu.com/acmiyou/archive/2009/07/31/91811.html綾蟲父綾蟲父Fri, 31 Jul 2009 07:30:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/31/91811.htmlhttp://www.shnenglu.com/acmiyou/comments/91811.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/31/91811.html#Feedback1http://www.shnenglu.com/acmiyou/comments/commentRss/91811.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/91811.html闃呰鍏ㄦ枃

綾蟲父 2009-07-31 15:30 鍙戣〃璇勮
]]>
opengl瀛︿範 nehe opengl lesson_7http://www.shnenglu.com/acmiyou/archive/2009/07/26/91242.html綾蟲父綾蟲父Sun, 26 Jul 2009 06:21:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/26/91242.htmlhttp://www.shnenglu.com/acmiyou/comments/91242.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/26/91242.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/91242.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/91242.html闃呰鍏ㄦ枃

綾蟲父 2009-07-26 14:21 鍙戣〃璇勮
]]>
opengl瀛︿範 nehe opengl lesson_6http://www.shnenglu.com/acmiyou/archive/2009/07/17/90386.html綾蟲父綾蟲父Fri, 17 Jul 2009 12:46:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/17/90386.htmlhttp://www.shnenglu.com/acmiyou/comments/90386.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/17/90386.html#Feedback3http://www.shnenglu.com/acmiyou/comments/commentRss/90386.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/90386.html闃呰鍏ㄦ枃

綾蟲父 2009-07-17 20:46 鍙戣〃璇勮
]]>
opengl瀛︿範 nehe opengl lesson_5http://www.shnenglu.com/acmiyou/archive/2009/07/17/90376.html綾蟲父綾蟲父Fri, 17 Jul 2009 10:24:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/17/90376.htmlhttp://www.shnenglu.com/acmiyou/comments/90376.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/17/90376.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/90376.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/90376.html闃呰鍏ㄦ枃

綾蟲父 2009-07-17 18:24 鍙戣〃璇勮
]]>
opengl 瀛︿範 nehe opengl lesson_4http://www.shnenglu.com/acmiyou/archive/2009/07/17/90353.html綾蟲父綾蟲父Fri, 17 Jul 2009 08:33:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/17/90353.htmlhttp://www.shnenglu.com/acmiyou/comments/90353.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/17/90353.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/90353.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/90353.html鎵鏈夌殑lesson 閮藉皢鍩轟簬lesson_1涓殑澶存枃浠惰屽啓.

lesson_4鐨勫唴瀹瑰湪lesson_3鐨勫熀紜涓婃坊鍔犱簡閮ㄥ垎鍐呭鑰屽啓鎴愮殑.榪欒褰撲腑,灝嗕細浣跨敤鍒版ā鍨嬪彉鎹㈢殑鏃嬭漿鍙樻崲.
鍓嶅嚑嬈?鏇句嬌鐢ㄤ簡glTranslatef(d)鏉ョЩ鍔ㄦā鍨?榪欐灝嗕嬌鐢╣lRotatef 鏉ユ棆杞ā鍨?鑰屼負浜嗙湅鍒頒竴涓姩鐢葷殑鏁堟灉,灝嗘敞鍐屼竴涓┖闂插洖璋冨嚱鏁?浣垮緱瑙掑害涓嶆柇鑷.

#include "openglglut.h"

/*
** opengl 鏁欑▼絎洓璇懼唴瀹?br>** 鍦ㄧ獥鍙g殑宸﹁竟閮ㄥ垎緇樺埗涓涓褰╃殑涓夎褰?瀹冨皢浣跨敤騫蟲粦鐫鑹?br>** 鍦ㄧ獥鍙g殑鍙寵竟閮ㄥ垎緇樺埗涓涓摑鑹茬殑姝f柟褰?瀹冨皢浣跨敤鍗曡皟鐫鑹?br>** 浣垮緱宸﹁竟鐨勪笁瑙掑艦緇昚杞翠笉鍋滄棆杞?br>** 浣垮緱鍙寵竟鐨勬鏂瑰艦緇晉杞翠笉鍋滄棆杞?br>
*/

double yRot=0.0;    //涓夎褰㈢粫y杞存棆杞殑瑙掑害
double xRot=0.0;    //涓夎褰㈢粫x杞存棆杞殑瑙掑害
int main(int argc, char** argv)
{
    
/** 鍒濆鍖栫獥鍙?nbsp;騫跺垱寤虹獥鍙?/span>*/
    createWindow(
"opengl lesson_4",&argc,argv);

    
/** 娉ㄥ唽glut鐨勪竴浜涘嚱鏁?nbsp;*/
    glutReshapeFunc(glutResize);     
//紿楀彛璋冩暣鍑芥暟 浣垮緱璋冩暣鍚庡浘褰㈡樉紺轟笉鍙戠敓鏀瑰彉
    glutIdleFunc(glutIdle);          //絀洪棽鍥炶皟鍑芥暟 浣垮緱鍦ㄧ┖闂叉椂闂村唴榪涜涓浜涙搷浣?/span>
    glutDisplayFunc(glutDisplay);    //閲嶇粯鍑芥暟     浣垮緱鍙互鍦ㄧ獥鍙d腑緇樺埗鍥懼艦
    glutSpecialFunc(glutSpecial);    //鐗規畩鎸夐敭鍑芥暟 浣垮緱瀹炵幇鍏ㄥ睆/紿楀彛鍒囨崲
    /** 鍒濆鍖杘pengl鐨勪竴浜涙搷浣?/span>*/
    InitOpenGL();

    
/** 榪涘叆浠跨湡寰幆*/
    glutMainLoop();
}

/** 瀹炵幇澶存枃浠跺綋涓畾涔夌殑緇樺埗鍑芥暟 緇樺埗涓夎褰㈠拰姝f柟褰?nbsp;**/
void glutDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT 
| GL_DEPTH_BUFFER_BIT);

    glLoadIdentity();                   
//灝嗗厛鍒濆鍖栧崟浣嶇煩闃?/span>
    glPushMatrix();                     //灝嗗綋鍓嶇煩闃靛鍒朵竴涓帇鍏ユ爤欏?騫朵繚鎸佸綋鍓嶇煩闃典笉鍙?/span>
    
    glTranslatef(
-1.5,0.0,-6.0);
    glRotatef(yRot,
0.0,1.0,0.0);        //浣垮緱涓夎褰㈢粫y杞存棆杞瑈Rot瑙掑害

    
//鍐沖畾涓夎褰笁涓《鐐圭殑棰滆壊鍊?涓夎褰㈠唴閮ㄥ悇涓偣鐨勯鑹插皢浼氭槸綰挎ф彃鍊肩殑
    glBegin(GL_TRIANGLES);             // 緇樺埗涓夎褰?/span>
        glColor3f(1.0f,0.0f,0.0f);     //浣跨敤綰㈣壊緇樺埗涓婇《鐐?/span>
        glVertex3f( 0.0f1.0f0.0f); //涓婇《鐐?/span>
        glColor3f(0.0f,1.0f,0.0f);     //浣跨敤緇胯壊緇樺埗宸︿笅欏剁偣
        glVertex3f(-1.0f,-1.0f0.0f); //宸︿笅
        glColor3f(0.0f,0.0f,1.0f);     //浣跨敤钃濊壊緇樺埗鍙充笅欏剁偣
        glVertex3f( 1.0f,-1.0f0.0f); //鍙充笅
    glEnd();
    glPopMatrix();                     
//鎭㈠褰撳墠鐭╅樀涓轟笂涓嬈ush鏃剁殑鐭╅樀

    glTranslatef(
1.5f,0.0f,-6.0f);
    glRotatef(xRot,
1.0,0.0,0.0);       //浣垮緱姝f柟褰㈢粫x杞存棆杞瑇Rot瑙掑害
    glColor3f(0.0f,0.0f,1.0f);         //灝嗗綋鍓嶉鑹插艱緗負钃濊壊 緇樺埗鏁翠釜姝f柟褰?/span>
    glBegin(GL_QUADS);                 // 緇樺埗姝f柟褰?/span>
        glVertex3f(-1.0f1.0f0.0f); // 宸︿笂
        glVertex3f( 1.0f1.0f0.0f); // 鍙充笂
        glVertex3f( 1.0f,-1.0f0.0f); // 宸︿笅
        glVertex3f(-1.0f,-1.0f0.0f); // 鍙充笅
    glEnd();

    glutSwapBuffers();                 
//寮哄埗緇樺浘鍛戒護鎵ц緇樺埗鍦ㄧ紦鍐插尯浜ゆ崲鍑烘潵
}

/** 瀹炵幇澶存枃浠跺綋涓0鏄庣殑絀洪棽鍥炶皟鍑芥暟*/
void glutIdle(void)
{
    yRot
+=0.2f;              //澧炲姞涓夎褰㈡棆杞搴?/span>
    xRot-=0.15f;              //鍑忓皯姝f柟褰㈠噺灝戣搴?/span>
    glutPostRedisplay();    //浣垮緱鎵ц瀹岃鍑芥暟鍚庤皟鐢ㄩ噸緇樺嚱鏁?/span>
}

鏈緇堢殑緇撴灉鏄?


鏈熬鎬葷粨:
glRotatef(angle,x,y,z) 灝嗕負浣垮緱妯″瀷緇曚換鎰忚醬鏃嬭漿angle瑙掑害.瀹冨皢浼氫駭鐢熶竴涓棆杞煩闃靛彸涔樺綋鍓嶇煩闃?鎵浠ユ敼鍙樹簡褰撳墠鐭╅樀.鑰屼負浜嗕嬌寰楃粯鍒剁殑鏃跺欏乏杈圭殑涓夎褰笉褰卞搷鍒板彸杈規鏂瑰艦鐨勫彉鎹㈢煩闃墊晠鍦ㄧ粯鍒朵笁瑙掑艦涔嬪墠浣跨敤glPushMatrix()淇濆瓨褰撳墠鐭╅樀,緇樺埗瀹屾垚涔嬪悗浣跨敤glPopMatrix() 鎭㈠涔嬪墠鐨勭煩闃?褰撶劧涔熷彲浠ヤ嬌鐢╣lLoadIdentity()璁劇疆褰撳墠鐭╅樀涓哄崟浣嶇煩闃電殑鏂規硶鏉ュ疄鐜板畠..

鍏舵,榪欐澶氫簡浠ヤ釜glIdleFunc() 娉ㄥ唽絀洪棽鍥炶皟鍑芥暟.鍗沖湪緋葷粺娌℃湁鍏朵粬浜嬩歡澶勭悊鐨勬椂鍊欏皢澶勭悊榪欎釜鍑芥暟,浣垮緱鏃嬭漿鐨勮搴︿笉鏂敼鍙?

glPostRedisplay() 浣垮緱褰撳墠紿楀彛灝嗕細榪涜閲嶇粯..鏍規嵁瑙掑害鐨勬敼鍙?浠庤屼嬌寰楁垜浠湅鍒扮殑鏄竴涓棆杞綋涓殑鍔ㄧ敾鏁堟灉

鏈鍚庡皢璇存槑涓鐐圭殑鏄?鎴戞浘鍦ㄧ孩瀹濅功鐪嬪埌涓孌靛唴瀹?鏈夋椂鍊欎負浜嗗疄鐜拌繛緇殑鏃嬭漿,鎴戜滑鍙兘浼氭兂鍒伴噸澶嶅簲鐢ㄤ竴涓煎緢灝忕殑鏃嬭漿鐭╅樀,榪欎釜浼氬瓨鍦ㄤ竴涓棶棰?灝辨槸璇樊,浣垮緱鍙樻崲绱Н緇撴灉.鎴戜滑搴旇鎽掑純榪欑鍋氭硶.鍗充嬌鐢ㄤ竴涓柊鐨勮搴︽潵鍙樻崲.灝卞皢浣跨敤濡備笅鐨勬柟娉?
glLoadIdentity();
glRotatef(new_angle,x,y,z);

鍙new_angle=old_angle+offset


綾蟲父 2009-07-17 16:33 鍙戣〃璇勮
]]>
opengl瀛︿範 nehe opengl lesson_3http://www.shnenglu.com/acmiyou/archive/2009/07/15/90138.html綾蟲父綾蟲父Wed, 15 Jul 2009 06:48:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/15/90138.htmlhttp://www.shnenglu.com/acmiyou/comments/90138.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/15/90138.html#Feedback1http://www.shnenglu.com/acmiyou/comments/commentRss/90138.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/90138.html鎵鏈塴esson閮藉皢鍩轟簬lesson_1涓ご鏂囦歡鑰屽啓

lesson_2涓?鐭ラ亾浜嗗浣曠畝鍗曠殑緇樺埗鍩烘湰鍥懼艦鐨勫悗,榪欐灝嗚瀛︿範濡備綍浣跨敤glColor3d(f)鏉ヨ緗畂pengl鐘舵佹満涓殑棰滆壊.浣垮緱緇樺埗鏃跺欏皢閲囩敤鑷畾涔夌殑棰滆壊鍊?

#include "openglglut.h"

/*
** opengl 鏁欑▼絎笁璇懼唴瀹?br>** 鍦ㄧ獥鍙g殑宸﹁竟閮ㄥ垎緇樺埗涓涓褰╃殑涓夎褰?瀹冨皢浣跨敤騫蟲粦鐫鑹?br>** 鍦ㄧ獥鍙g殑鍙寵竟閮ㄥ垎緇樺埗涓涓摑鑹茬殑姝f柟褰?瀹冨皢浣跨敤鍗曡皟鐫鑹?br>
*/

int main(int argc, char** argv)
{
    
/** 鍒濆鍖栫獥鍙?nbsp;騫跺垱寤虹獥鍙?/span>*/
    createWindow(
"opengl lesson_3",&argc,argv);

    
/** 娉ㄥ唽glut鐨勪竴浜涘嚱鏁?nbsp;*/
    glutReshapeFunc(glutResize);     
//紿楀彛璋冩暣鍑芥暟 浣垮緱璋冩暣鍚庡浘褰㈡樉紺轟笉鍙戠敓鏀瑰彉
    glutDisplayFunc(glutDisplay);    //閲嶇粯鍑芥暟     浣垮緱鍙互鍦ㄧ獥鍙d腑緇樺埗鍥懼艦
    glutSpecialFunc(glutSpecial);    //鐗規畩鎸夐敭鍑芥暟 浣垮緱瀹炵幇鍏ㄥ睆/紿楀彛鍒囨崲
    
    
/** 鍒濆鍖杘pengl鐨勪竴浜涙搷浣?/span>*/
    InitOpenGL();

    
/** 榪涘叆浠跨湡寰幆*/
    glutMainLoop();
}


void glutDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT 
| GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();                   
//灝嗗厛鍒濆鍖栧崟浣嶇煩闃?/span>
    glPushMatrix();                     //灝嗗綋鍓嶇煩闃靛鍒朵竴涓帇鍏ユ爤欏?騫朵繚鎸佸綋鍓嶇煩闃典笉鍙?/span>
    glTranslatef(-1.5,0.0,-6.0);

    
//鍐沖畾涓夎褰笁涓《鐐圭殑棰滆壊鍊?涓夎褰㈠唴閮ㄥ悇涓偣鐨勯鑹插皢浼氭槸綰挎у樊鍊肩殑
    glBegin(GL_TRIANGLES);             // 緇樺埗涓夎褰?/span>
        glColor3f(1.0f,0.0f,0.0f);     //浣跨敤綰㈣壊緇樺埗涓婇《鐐?/span>
        glVertex3f( 0.0f1.0f0.0f); //涓婇《鐐?/span>
        glColor3f(0.0f,1.0f,0.0f);     //浣跨敤緇胯壊緇樺埗宸︿笅欏剁偣
        glVertex3f(-1.0f,-1.0f0.0f); // 宸︿笅
        glColor3f(0.0f,0.0f,1.0f);     //浣跨敤钃濊壊緇樺埗鍙充笅欏剁偣
        glVertex3f( 1.0f,-1.0f0.0f); // 鍙充笅
    glEnd();
    glPopMatrix();                     
//鎭㈠褰撳墠鐭╅樀涓轟笂涓嬈ush鏃剁殑鐭╅樀

    glTranslatef(
1.5f,0.0f,-6.0f);
    glColor3f(
0.0f,0.0f,1.0f);         //灝嗗綋鍓嶉鑹插艱緗負钃濊壊 緇樺埗鏁翠釜姝f柟褰?/span>
    glBegin(GL_QUADS);                 // 緇樺埗姝f柟褰?/span>
        glVertex3f(-1.0f1.0f0.0f); // 宸︿笂
        glVertex3f( 1.0f1.0f0.0f); // 鍙充笂
        glVertex3f( 1.0f,-1.0f0.0f); // 宸︿笅
        glVertex3f(-1.0f,-1.0f0.0f); // 鍙充笅
    glEnd();

    glutSwapBuffers();                 
//寮哄埗緇樺浘鍛戒護鎵ц緇樺埗鍦ㄧ紦鍐插尯浜ゆ崲鍑烘潵
}

鏈鍚庣殑鏁堟灉鍥?

鏈熬鎬葷粨:

glColor3f(d)灝嗘寚瀹歰penggl鐘舵佷腑棰滆壊鍊?浣垮緱緇樺埗鐨勬椂鍊欓兘灝嗕嬌鐢ㄨ繖涓鑹插?鐩村埌鍐嶆淇敼榪欎釜鍊?鍦ㄧ粯鍒舵鏂瑰艦鐨勫彲浠ュ緱鍒拌繖涓В閲?
鍏舵, 緇樺埗涓夎褰㈢殑鏃跺?鍙槸鎸囧畾涓変釜欏剁偣鐨勭敤涓夌涓嶅悓棰滆壊緇樺埗,涓轟粈涔堢粨鏋滀細浣垮緱涓夎褰㈠彉鎴愬僵鑹茬殑鍛?
鍏跺師鐞嗗湪浜庡畠浣跨敤浠繪剰涓ょ偣緇樺埗涓鏉$嚎孌電殑鏃跺?
綰挎鍐呯殑鍏朵粬浠諱竴鐐歸兘灝嗕細鏄繖涓ょ偣棰滆壊鍊肩殑涓涓嚎鎬ф彃鍊?


綾蟲父 2009-07-15 14:48 鍙戣〃璇勮
]]>
opengl瀛︿範<鍥?gt; nehe opengl lesson_2http://www.shnenglu.com/acmiyou/archive/2009/07/15/90118.html綾蟲父綾蟲父Wed, 15 Jul 2009 03:09:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/15/90118.htmlhttp://www.shnenglu.com/acmiyou/comments/90118.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/15/90118.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/90118.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/90118.htmllesson_2鐨勪唬鐮佸皢鍩轟簬lesson_1涓墍鍒涘緩鐨勫ご鏂囦歡鑰屽疄鐜?.
鍏舵鎴戞兂璇翠笅 鎴戜負浠涔堟病鏈夊皢glut娉ㄥ唽鍑芥暟閭e潡涔熷畾涔夋垚鍏辯敤鐨?鍥犱負鏈変簺鍑芥暟鎴戝皻鏈疄鐜版垨鑰呭皻鏈冭檻鍒拌濡備綍瀹炵幇,鎬誨湪鍙樺寲鐨?鏁呰屾垜灝嗗畠鍒嗙鍑烘潵浜?鍙互寰堣偗瀹氱殑浜嬫垜闇瑕佷粈涔堝氨娉ㄥ唽浠涔堝嚱鏁?榪欐牱涔熸槸搴旇鏉ヨ姣旇緝娓呮櫚鐨?

nehe lesson_2涓殑鏄疄鐜頒簡鍦ㄧ獥鍙e乏杈圭粯鍒朵竴涓笁瑙掑艦,鍦ㄧ獥鍙e彸杈圭粯鍒朵簡涓涓鏂瑰艦.

#include "openglglut.h"

/*
** opengl 鏁欑▼絎簩璇懼唴瀹?br>** 鍦ㄧ獥鍙g殑宸﹁竟閮ㄥ垎緇樺埗涓涓櫧鑹茬殑涓夎褰?br>** 鍦ㄧ獥鍙g殑鍙寵竟閮ㄥ垎緇樺埗涓涓櫧鑹茬殑姝f柟褰?br>
*/

int main(int argc, char** argv)
{
    
/** 鍒濆鍖栫獥鍙?nbsp;騫跺垱寤虹獥鍙?/span>*/
    createWindow(
"opengl lesson_2",&argc,argv);

    
/** 娉ㄥ唽glut鐨勪竴浜涘嚱鏁?nbsp;*/        
    glutReshapeFunc(glutResize);     
//紿楀彛璋冩暣鍑芥暟 浣垮緱璋冩暣鍚庡浘褰㈡樉紺轟笉鍙戠敓鏀瑰彉
    glutDisplayFunc(glutDisplay);    //閲嶇粯鍑芥暟     浣垮緱鍙互鍦ㄧ獥鍙d腑緇樺埗鍥懼艦
    glutSpecialFunc(glutSpecial);    //鐗規畩鎸夐敭鍑芥暟 浣垮緱瀹炵幇鍏ㄥ睆/紿楀彛鍒囨崲

    
/** 鍒濆鍖杘pengl鐨勪竴浜涙搷浣?/span>*/
    InitOpenGL();

    
/** 榪涘叆浠跨湡寰幆*/
    glutMainLoop();
}


/** 瀹炵幇澶存枃浠跺綋涓畾涔夌殑緇樺埗鍑芥暟 緇樺埗涓夎褰㈠拰姝f柟褰?nbsp;**/
void glutDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT 
| GL_DEPTH_BUFFER_BIT);
    
    glLoadIdentity();                   
//灝嗗厛鍒濆鍖栧崟浣嶇煩闃?/span>
    glPushMatrix();                    //灝嗗綋鍓嶇煩闃靛鍒朵竴涓帇鍏ユ爤欏?騫朵繚鎸佸綋鍓嶇煩闃典笉鍙?/span>
    glTranslatef(-1.5,0.0,-6.0);       //宸︾Щ鍔?.5騫跺悜灞忓箷鍐呴儴縐誨姩6.0 鍦ㄩ偅鍖哄煙鐢諱笁瑙掑艦
    glBegin(GL_TRIANGLES);             // 緇樺埗涓夎褰?/span>
        glVertex3f( 0.0f1.0f0.0f); // 涓婇《鐐?/span>
        glVertex3f(-1.0f,-1.0f0.0f); // 宸︿笅
        glVertex3f( 1.0f,-1.0f0.0f); // 鍙充笅
    glEnd();
    glPopMatrix();                     
//鎭㈠褰撳墠鐭╅樀涓轟笂涓嬈ush鏃剁殑鐭╅樀

    glTranslatef(
1.5f,0.0f,-6.0f);     //鍙崇Щ鍔?.5騫跺悜灞忓箷鍐呴儴縐誨姩6.0 鍦ㄩ偅鍖哄煙鐢諱笁瑙掑艦

    glBegin(GL_QUADS);                 
// 緇樺埗姝f柟褰?/span>
        glVertex3f(-1.0f1.0f0.0f); // 宸︿笂
        glVertex3f( 1.0f1.0f0.0f); // 鍙充笂
        glVertex3f( 1.0f,-1.0f0.0f); // 宸︿笅
        glVertex3f(-1.0f,-1.0f0.0f); // 鍙充笅
    glEnd();

    glutSwapBuffers();                 
//寮哄埗緇樺浘鍛戒護鎵ц緇樺埗鍦ㄧ紦鍐插尯浜ゆ崲鍑烘潵
}

鏈緇堟樉紺虹粨鏋滀負:


鏈熬鎬葷粨:
             浠庝腑鎴戝鍒板浣曠粯鍒秓pengl鐨勫熀鏈浘鍏?涓夎褰?鍥涜竟褰?鐢氳嚦澶氳竟褰?
            鍏舵榪樼悊瑙d簡glpushMatrix() glpopMatrix()鐨勫惈涔夊嵆浣跨敤瑙勫垯絳?
            glpushMatrix() 淇濆瓨浜嗗綋鍓嶇煩闃?浣垮緱鍏跺悗鍙互鎭㈠鍘熸潵鐨勪綅緗繘琛岀粯鍒?br>            glpopMatrix() 鎭㈠褰撳墠鐭╅樀涓烘爤欏剁煩闃?.

綾蟲父 2009-07-15 11:09 鍙戣〃璇勮
]]>
opengl 瀛︿範<涓?gt; nehe opengl lesson_1http://www.shnenglu.com/acmiyou/archive/2009/07/15/90106.html綾蟲父綾蟲父Wed, 15 Jul 2009 01:28:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/15/90106.htmlhttp://www.shnenglu.com/acmiyou/comments/90106.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/15/90106.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/90106.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/90106.html闃呰鍏ㄦ枃

綾蟲父 2009-07-15 09:28 鍙戣〃璇勮
]]>
opengl 瀛︿範<浜?gt;http://www.shnenglu.com/acmiyou/archive/2009/07/14/90075.html綾蟲父綾蟲父Tue, 14 Jul 2009 13:38:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/14/90075.htmlhttp://www.shnenglu.com/acmiyou/comments/90075.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/14/90075.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/90075.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/90075.html     鍦ㄥ涔犱笂錛屾垜鎬諱細鏄潅涔辨棤绔犵殑瀛︺備負浠涔堝憿銆傛垜涓鑸槸鍦ㄩ渶瑕佹煇涓悊璁虹殑鏃跺欐墠浼氬幓娣辯┒鐞嗚鍐呴儴鐨勫悇縐嶈緇嗘満鍒訛紝褰撶劧鍓嶆彁蹇呴』鏄綘瀵硅繖鏂歸潰鐭ヨ瘑蹇呴』鏈変竴鐐圭殑浜嗚В錛屼笉闇瑕佷簡瑙g殑瓚沖娣卞叆銆傚叾瀹炴垜鎯寵繖涔熸槸璇諱功鐨勪竴縐嶆柟娉曞惂銆傚浜庣湅涔︽垜鍚戞潵鍏堝緢綺楃硻鐨勬祻瑙堟暣涔︿竴閬嶏紝澶ф灝卞彧鐪嬩竴浜涙蹇碉紝浜嗚В榪欎功鐨勪富瑕佸唴瀹?鏂瑰悜絳夈傜浜岄亶鍒欐槸璇︾粏鐨勭悊瑙e唴瀹癸紝鏌愪簺鏃跺欐湁浜涘唴瀹歸兘鏄緢鏈変箣鍚庢墠鏈夊績鍘葷湅鐨勩?/p>

     鍏跺疄浠婂ぉ鍦ㄦ葷粨榪欎釜鐨勬椂鍊欙紝騫朵笉鏄湪鐢╫pengl鑰屾槸鍦ㄤ嬌鐢╫sg璁捐涓涓」鐩漢鐗╂苯杞﹁濺絳夋極娓哥被銆婂彲鑳藉簲鐢ㄥ湪鎵嬫満錛屾苯杞﹀鑸笂銆嬬殑鏃跺欙紝鎯寵搗鎬葷粨榪欑殑銆傛垜鍏跺疄鏄兂鐢諱簺鍥炬潵鍐欒繖浠芥葷粨鍙兘浼氭洿瀹規槗鐞嗚В鐨?鐒惰屽疄鍦ㄦ噿...

 

     鍦ㄥ浘褰㈠鐨勬樉紺烘祦紼嬶細

      涓夌淮鍥懼艦->妯″瀷瑙嗗浘鍙樻崲->鎶曞獎鍙樻崲->涓夌淮瑁佸壀->瑙嗗彛->灞忓箷鍥懼艦鏄劇ず

 

     涓夌淮->浜岀淮鐨勫彉鎹紝鎬葷殑鏉ョ悊瑙e彧鏄笁緇寸殑鐗╀綋鍦ㄤ竴緋誨垪鐨勫彉鎹箣鍚庡喅瀹氫簡灞忓箷涓婃煇浜涘儚绱犱綅緗殑棰滆壊鍊箋傛渶鍚庤繖浜涢鑹茬粍鎴愪簡涓騫呭浘鐢匯傚氨鏄垜浠墍鐪嬪埌寰楁渶緇堝睆騫曚簩緇村浘褰簡銆?/p>

 

     鍦ㄥぇ姒備簡瑙h繖縐嶆祦紼嬩箣鍚庯紝妯″瀷瑙嗗浘鍙樻崲 鏃犵枒灝嗘垚涓哄喅瀹氭垜浠墍灝嗙湅鍒扮殑鍥懼儚鐨勮疆寤撱?/p>

     妯″瀷瑙嗗浘鍙樻崲 搴旇鏉ヨ鏄寘鍚袱涓彉鎹㈢殑:妯″瀷鍙樻崲,瑙嗗浘鍙樻崲銆備負浠涔堝皢浠栦滑鍚堝湪涓璧峰憿錛?鍦ㄧ収鐩告満鎴愬儚緋葷粺涓?鑻ュ浐瀹氱浉鏈轟笉鍔ㄧЩ鍔ㄦā鍨嬩細 絳変環浜?/span> 鍥哄畾妯″瀷涓嶅姩縐誨姩鐩告満銆?/p>

     鑰冪┒濡備笅鍐呭錛?/p>

    

     glMatrixMode(GL_MODELVIEW);

     glLoadIdentity();                   //褰撳墠鐭╅樀璁劇疆涓哄崟浣嶇煩闃?/p>

     glRotatef(45.0f,0.0,0.0,1.0); //鎸塠0.0,0.0,1.0]涓鴻醬鏃嬭漿45搴?/p>

     glTranslatef(2.0,2.0,2.0);     // 騫崇Щ鑷?[2.0,2.0,2.0]

     glBegin(...);                       // 鐢繪煇浜涗笢瑗?br>        ...
        ...
        ...
     glEnd();

 

     鏈変袱縐嶆柟寮忕悊瑙o細涓縐嶆槸灞閮ㄥ潗鏍囩郴鐨勭悊瑙o紝涓縐嶆槸鍏ㄥ眬鍧愭爣緋葷殑鐞嗚В銆?/p>

     濡傛灉鎸夌収涓婇潰閭d簺鍐呭浠庝笂鍒頒笅鐨勭悊瑙g殑鏂瑰紡灝辨槸灞閮ㄥ潗鏍囩郴鐨勭悊瑙?/span>銆俹pengl鍙樻崲涓婄殑瀹炵幇鍏跺疄鏄釜鐭╅樀鐨勪箻娉曘傛寜鐓у眬閮ㄥ潗鏍囩郴鐨勭悊瑙?涓婇潰浠g爜鐨勫彉鎹㈡槸鎸夌収榪欐牱鐨勯『搴忔墽琛岀殑:

鍏堝皢灞閮ㄥ潗鏍囩郴緇晍杞存棆杞?5搴︼紝鍦ㄥ皢灞閮ㄥ潗鏍囩郴鐨勫師鐐瑰鉤縐昏嚦[2.0,2.0,2.0]錛岀劧鍚庡湪灞閮ㄥ潗鏍囩郴鍐呯敾鐗╀綋銆?/p>

      鍋囪 鏃嬭漿姝ラ鐨勭煩闃典負R錛屽鉤縐婚儴鍒嗙殑鐭╅樀涓篢 褰撳墠鐭╅樀涓篊銆?/p>

      new_C=old_C*R*T 榪欐槸涓涓煩闃靛彸涔樻搷浣?/p>

      鐞嗚涓婃潵璁?榪欏氨鏄竴涓潗鏍囩郴鐨勫彉鎹㈣繃紼嬶紝R*T 榪欎釜鐭╅樀鍏跺疄灝辨槸灝嗗師鍏堢殑鍧愭爣緋誨彉鎹㈠埌鐜板湪鐨勫潗鏍囩郴錛岃繖涓椂鍊欏師鍏堝潗鏍囩郴鐨勭偣p灝嗗彉鎹㈡垚p1,p1=(R*T)*p銆?/p>

      鑰屾寜鐓у叏灞鍧愭爣緋葷殑鐞嗚В錛屽畠鐨勫彉鎹㈣繃紼嬪垯鏄浉鍙嶇殑錛岃繖涔熸槸鐩稿綋鐨勫ソ鐞嗚В鐨?鍦ㄥ綋鍓嶄笘鐣屽潗鏍囩郴涓敾濂借鐗╀綋涔嬪悗錛屾垜蹇呴』灝嗗畠縐誨姩鍒版紜殑浣嶇疆銆傞偅蹇呴』寰楀厛騫崇Щ鐗╀綋鍒癧2.0,2.0,2.0],鐒跺悗灝嗙墿浣撶粫z杞存棆杞?5搴︺傝繖鏄竴涓浉鍙嶇殑鍙樻崲榪囩▼錛岀劧鑰岃繖涓笌鍓嶉潰鐨勬槸絳変環鐨?涓轟粈涔堬紵

      鑰冭檻涓栫晫鍧愭爣緋諱笅鐐筽錛岀粡榪囧鉤縐繪搷浣滃悗 p11=T*p; 鍦ㄧ粡榪囨棆杞搷浣滃悗 p1=R*P11=R*(T*p)  榪欐槸鐭╅樀鐨勪竴涓乏涔樻搷浣?鍏堝彉鎹㈢殑鍦ㄥ悗闈? 鎵浠ヨnew_C=(old_c*(R*(T))) 宸︿箻 鎵浠ヨ榪欐槸涓涓瓑浠風殑榪囩▼.

 

      涓鑸潵灝嗭紝鎴戜滑鑰冭檻鐨勬椂鍊欐繪槸涓栫晫鍧愭爣緋昏冭檻鏃嬭漿騫崇Щ絳夋搷浣滅殑.鎵浠ュ湪鍐欏彉鎹㈢殑鏃跺欐渶濂界殑鏂瑰紡灝辨槸灝?鍙樻崲姝ラ涓鐩村乏涔橈紝鑰屼唬鐮佷腑鍒欐寜宸︿箻鍚庣粨鏋滅煩闃電殑欏哄簭鍐欎唬鐮併?/p>

 

      鍏舵鍦ㄧ悊瑙d互涓婄殑鍙樻崲榪囩▼涓ā鍨嬪彉鎹㈢殑鍘熺悊錛屾垜浠彲浠ュ緢濂界殑鐞嗚ВgluLookAt(eye,center,up)鐨勮鍥懼彉鎹㈢殑榪囩▼錛岀幇鍦ㄥ彧鑰冭檻妯″瀷涓嶅姩錛岀収鐩告満縐誨姩鐨勮繃紼嬶紝涓旀槸鍦ㄥ叏灞鍧愭爣緋諱笅鐨勭Щ鍔ㄨ繃紼?

     opengl榛樿鐓х浉鏈烘鏋?鏄鐐瑰湪鍘熺偣 y杞翠負鍚戜笂鏂瑰悜 z杞磋礋鏂瑰悜涓鴻綰挎柟鍚?/span>

 

     gluLookAt鐨勭洰鐨勫湪浜庝嬌寰楄鐐圭Щ鍔ㄥ埌eye浣嶇疆 騫剁湅鍚慶enter銆?/span>

     鍒檊luLookAt鐨勮繃紼嬪厛騫崇Щ鑷砮ye,鑰宑enter->eye(center鎸囧悜eye)鍒欎負z鏂瑰悜璁句負z(Zx,Zy,Zz),Up鏂瑰悜涓簓杞存柟鍚戯紝y,z鐨勫弶縐垯涓簒杞存柟鍚?鍒欏彧闇灝嗗畠浠兘鏃嬭漿鍒頒綅灝辮浜?/span>

 

    鎵浠ヨ繖涓椂鍊欐ā鍨嬪彉鎹㈢煩闃靛氨涓恒婄浉瀵逛簬妯″瀷鏉ヨ 鐩告満縐誨姩鍒癳ye絳変環浜庢ā鍨嬬Щ鍔ㄥ埌-eye.

    |Xx Xy Xz  0|        |1   0   0   -eyex|

    |Yx Yy Yz  0|    *  |0   1  0    -eyey|

    |Zx  Zy Zz  0|         |0   0  1    -eyez|

    |0   0   0     1|         |0   0  0       1   |



綾蟲父 2009-07-14 21:38 鍙戣〃璇勮
]]>
opengl 瀛︿範<1>http://www.shnenglu.com/acmiyou/archive/2009/07/04/89249.html綾蟲父綾蟲父Sat, 04 Jul 2009 10:36:00 GMThttp://www.shnenglu.com/acmiyou/archive/2009/07/04/89249.htmlhttp://www.shnenglu.com/acmiyou/comments/89249.htmlhttp://www.shnenglu.com/acmiyou/archive/2009/07/04/89249.html#Feedback0http://www.shnenglu.com/acmiyou/comments/commentRss/89249.htmlhttp://www.shnenglu.com/acmiyou/services/trackbacks/89249.htmlglut鏄痮pengl杈呭姪搴?

鐜伴氳繃瀹冨疄鐜頒竴涓綅浜巣=0騫抽潰鐨勬鏂瑰艦 騫剁粫z杞存棆杞?

/**  

   One workaround to this issue is requiring users to always link with
   the same CRT as GLUT is compiled with.  That requires users supply a
   non-standard option.  GLUT 3.7 has its own built-in workaround where
   the executable's "exit" function pointer is covertly passed to GLUT.
   GLUT then calls the executable's exit function pointer to ensure that
   any "atexit" calls registered by the application are called if GLUT
   needs to exit.

   Note that the __glut*WithExit routines should NEVER be called directly.
   To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK.

**
*/

/**
** That for why define below
*
*/

#define GLUT_DISABLE_ATEXIT_HACK 


#ifdef WIN32
  #include 
<windows.h>
#endif

#include
<gl/gl.h>
#include
<GL/glut.h>

GLfloat angle
=0.0;

/*
*鏄劇ず鍥炶皟鍑芥暟
*/

void display()
{
    
//clear the color buffer 鍗蟲瘡甯ф竻灞?/span>
    glClear(GL_COLOR_BUFFER_BIT);

    
//璁劇疆妯″瀷瑙嗗浘鐭╅樀
    glMatrixMode(GL_MODELVIEW);
    
//璁劇疆褰撳墠鐭╅樀涓哄崟浣嶇煩闃?/span>
    glLoadIdentity();
    
//灝嗘鏂瑰艦鎸墇杞存棆杞?nbsp;angle瑙掑害
    glRotatef(angle,0.0,0.0,1.0);

    
//鐢諱竴涓鏂瑰艦
    glBegin(GL_QUADS);
        glVertex3f(
-0.5,-0.5,0.0);
        glVertex3f(
0.5,-0.5,0.0);
        glVertex3f(
0.5,0.5,0.0);
        glVertex3f(
-0.5,0.5,0.0);
    glEnd();
    
//glFlush();
    
//鍙岀紦瀛?nbsp;鏄劇ず涓甯э紝涓嬩竴甯у凡緇忓湪緙撳啿鍖虹敾濂?浜ゆ崲鍑烘潵灝卞ソ
    
//鏈韓甯︽湁涓涓己鍒剁殑glFlush();
    glutSwapBuffers();
}

/*
*絀洪棽鏃墮棿鍥炶皟鍑芥暟
*/

void idlefunc()
{
    
//瑙掑害鑷 瀹炵幇姝f柟褰㈢殑鏃嬭漿
    angle+=1.0;
    
if(angle>=360.0f
        angle
=0.0;
    
//浣垮緱鍑芥暟鎵ц瀹屾垚鍚庯紝璋冪敤閲嶇粯鍑芥暟
    glutPostRedisplay();
}

/*
*win32 main鍑芥暟
*/

void main(int argc, char **argv)
{
    
//鍒濆鍖?nbsp;glut
    glutInit(&argc, argv);
    
//鍒濆鍖栨樉紺烘ā寮忎負 RGB 鍜屽弻緙撳啿
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    
//璁劇疆紿楀彛宸︿笂瑙掍綅緗?/span>
    glutInitWindowPosition(100,100);
    
//璁劇疆紿楀彛鐨勫垵濮嬪寲澶у皬
    glutInitWindowSize(512,512);
    
//鍒涘緩涓涓獥鍙f爣棰樹負  "瀛楃涓?
    glutCreateWindow("3D Tech- GLUT Tutorial");
    
//娉ㄥ唽鏄劇ず鍥炶皟鍑芥暟
    glutDisplayFunc(display);
    
//娉ㄥ唽絀洪棽鏃墮棿鍑芥暟
    glutIdleFunc(idlefunc);
    
//璁劇疆澶氳竟褰㈢粯鍒舵ā寮忎負姝i潰錛岀嚎妗嗗紡
    glPolygonMode(GL_FRONT,GL_LINE);
    
//榪涘叆浠跨湡寰幆
    glutMainLoop();
}










綾蟲父 2009-07-04 18:36 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久亚洲一区二区三区四区| 久久er99精品| 欧美国产在线视频| 久久婷婷久久一区二区三区| 亚洲二区三区四区| 欧美顶级艳妇交换群宴| 蜜臀久久99精品久久久久久9| 伊人久久综合| 亚洲国产综合视频在线观看| 久久久免费精品视频| 亚洲黑丝在线| 亚洲美女色禁图| 国产精品久久久久av免费| 亚洲一本视频| 久久精品女人| 9国产精品视频| 亚洲在线视频观看| 在线观看欧美一区| 亚洲日产国产精品| 国产香蕉97碰碰久久人人| 麻豆成人在线观看| 欧美日韩国产成人在线观看| 午夜日韩福利| 毛片一区二区| 欧美亚洲三区| 欧美成人一区二区在线| 欧美一级黄色录像| 免费看亚洲片| 欧美专区在线| 欧美日韩成人在线播放| 久久高清国产| 欧美日本在线视频| 性色av一区二区三区在线观看| 久久婷婷亚洲| 午夜精品久久一牛影视| 老牛影视一区二区三区| 亚洲欧美日韩精品久久| 欧美国产日韩二区| 久久理论片午夜琪琪电影网| 欧美日本免费一区二区三区| 蜜臀av性久久久久蜜臀aⅴ| 国产精品高潮呻吟久久| 亚洲国产导航| 在线观看成人av| 亚洲一区精品视频| 亚洲伦理精品| 老色批av在线精品| 久久久久久久久伊人| 欧美性生交xxxxx久久久| 欧美激情欧美激情在线五月| 狠狠色伊人亚洲综合成人| 亚洲影视九九影院在线观看| 一区二区毛片| 欧美成人免费观看| 欧美不卡视频一区发布| 国产一区二区三区在线观看网站| 一区二区三区不卡视频在线观看| 91久久久在线| 蜜臀久久99精品久久久久久9| 久久综合999| 国产一区二区三区四区三区四| 中文精品在线| 亚洲淫性视频| 国产精品久久久久久五月尺| 亚洲精品免费在线播放| 亚洲日本免费| 欧美国产欧美综合 | 亚洲欧洲另类国产综合| 欧美一区二区三区在线看| 羞羞视频在线观看欧美| 国产乱码精品一区二区三区不卡| 在线视频你懂得一区| 亚洲视频一区二区| 欧美新色视频| 亚洲视频一区在线观看| 欧美一区二区三区精品电影| 国产精品久久久久久久久久直播| 亚洲一区二区网站| 久久国产精品网站| 国产在线日韩| 久久亚洲视频| 亚洲国产aⅴ天堂久久| 亚洲激情视频网| 免费久久99精品国产自在现线 | 亚洲高清av| 久久琪琪电影院| 亚洲黄一区二区三区| 一区二区三区免费观看| 国产精品久久久久久影视| 午夜精品久久久久久久99黑人| 久久精品综合网| 亚洲国产精品99久久久久久久久| 欧美成人一区二区三区| 一区二区三区国产| 欧美一区二区视频在线观看| 国产一区二区三区成人欧美日韩在线观看| 欧美在线视频免费观看| 欧美激情视频在线播放| 亚洲制服欧美中文字幕中文字幕| 国产亚洲欧美日韩精品| 欧美国产成人精品| 亚洲——在线| 亚洲第一色中文字幕| 亚洲欧美激情在线视频| 一区二区视频免费在线观看| 欧美精品 日韩| 一本色道久久综合| 久久亚洲电影| 亚洲在线观看免费| 影院欧美亚洲| 国产精品网站在线播放| 免费人成网站在线观看欧美高清| 亚洲少妇在线| 亚洲第一黄色网| 久久久久欧美精品| 中文亚洲字幕| 在线看不卡av| 国产欧美精品| 欧美日韩在线视频一区| 久久噜噜亚洲综合| 性8sex亚洲区入口| 日韩一区二区免费高清| 欧美成人一区二区三区片免费| 欧美在线999| 亚洲一级影院| 91久久亚洲| 亚洲第一精品夜夜躁人人爽| 国产精品视频免费观看| 欧美精品九九| 欧美成ee人免费视频| 久久精品视频导航| 亚洲欧美综合精品久久成人| 日韩视频在线一区| 亚洲黑丝在线| 亚洲福利国产| 欧美国产第二页| 美女主播一区| 久久天天躁夜夜躁狠狠躁2022| 香蕉成人啪国产精品视频综合网| 亚洲深夜福利| 一本一本久久a久久精品综合麻豆| 亚洲国产精品久久| 狠狠色狠色综合曰曰| 国产在线欧美| 精品999成人| 永久免费视频成人| 伊人婷婷欧美激情| 伊人一区二区三区久久精品| 激情一区二区| 亚洲第一区中文99精品| 亚洲电影免费在线| 亚洲精品1区2区| 亚洲国产专区| 日韩午夜电影| 亚洲主播在线观看| 欧美一区三区二区在线观看| 久久精品国产综合精品| 玖玖国产精品视频| 欧美激情亚洲国产| 日韩视频专区| 亚洲欧美日韩国产另类专区| 亚洲综合视频在线| 久久久天天操| 欧美日韩国产一区二区| 欧美日韩亚洲高清| 国产精品视频网| 伊人久久综合97精品| 亚洲欧洲日本一区二区三区| 99亚洲精品| 久久国产精品一区二区| 麻豆久久婷婷| 亚洲免费不卡| 欧美专区一区二区三区| 欧美成人免费大片| 国产精品久久影院| 亚洲第一成人在线| 亚洲一本大道在线| 久久这里有精品视频| 日韩一区二区福利| 久久精品国产亚洲a| 欧美激情国产日韩| 国产深夜精品| 日韩一区二区福利| 久久精品国产成人| 亚洲美女电影在线| 久久精品欧美日韩| 国产精品ⅴa在线观看h| 欲香欲色天天天综合和网| 亚洲视频在线观看免费| 卡通动漫国产精品| 亚洲午夜国产成人av电影男同| 久久午夜视频| 国产麻豆9l精品三级站| 99视频一区二区| 免费不卡在线视频| 亚洲一区美女视频在线观看免费| 欧美成人精品激情在线观看| 国产亚洲欧美色| 亚洲宅男天堂在线观看无病毒| 亚洲国产经典视频|