1
是否有可能在整個遊戲中獲得模型的全局位置?模型的全球位置OpenGL
我試圖找出其中的值來自..根據我怎樣旋轉的攝像頭,這些值的變化。
不同的位置:
從gDebugger,我得到了這些值:
LOWEST ANGLE:
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99975264, 0.0091297952, -0.020280767, 0}
{0, 0.91186345, 0.41049367, 0}
{0.022241013, -0.41039214, 0.9116379, 0}
{1819.2891, -308.66016, 5129.084, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99975264, 0.0091297952, -0.020280767, 0}
{0, 0.91186345, 0.41049367, 0}
{0.022241013, -0.41039214, 0.9116379, 0}
{1819.2891, -308.66016, 5129.084, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99990994, 0.0055096098, -0.01223895, 0}
{0, 0.91186345, 0.41049367, 0}
{0.013421912, -0.41045669, 0.91178131, 0}
{255.48047, -56.457031, 4179.0703, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99990994, 0.0055096098, -0.01223895, 0}
{0, 0.91186345, 0.41049367, 0}
{0.013421912, -0.41045669, 0.91178131, 0}
{255.48047, -56.457031, 4179.0703, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99977756, 0.0086575896, -0.019231817, 0}
{0, 0.91186345, 0.41049367, 0}
{0.021090677, -0.41040236, 0.91166061, 0}
{248.38477, -85.074219, 4242.6367, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99977756, 0.0086575896, -0.019231817, 0}
{0, 0.91186345, 0.41049367, 0}
{0.021090677, -0.41040236, 0.91166061, 0}
{248.38477, -85.074219, 4242.6367, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}
HIGHEST:
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99966991, -0.010546137, 0.023427004, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.025691351, -0.41035816, 0.91156244, 0}
{223.3418, -60.19043, 4187.3594, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99997616, 0.0060372208, -0.0033470246, 0}
{0, 0.48486927, 0.87458664, 0}
{0.006902942, -0.87456578, 0.48485771, 0}
{3551.2305, 297.58008, 5957.9141, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99997616, 0.0060372208, -0.0033470246, 0}
{0, 0.48486927, 0.87458664, 0}
{0.006902942, -0.87456578, 0.48485771, 0}
{3551.2305, 297.58008, 5957.9141, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99997616, 0.0027075345, -0.0063497927, 0}
{0, 0.91986758, 0.39222905, 0}
{0.006902942, -0.39221969, 0.91984564, 0}
{-281.65234, -45.993164, 4131.0254, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99997616, 0.0027075345, -0.0063497927, 0}
{0, 0.91986758, 0.39222905, 0}
{0.006902942, -0.39221969, 0.91984564, 0}
{-281.65234, -45.993164, 4131.0254, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_MODELVIEW_MATRIX:
{0.99960816, 0.010978992, -0.02574827, 0}
{0, 0.91986758, 0.39222905, 0}
{0.027991278, -0.39207536, 0.91950715, 0}
{249.30078, -64.625977, 4174.7188, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_CURRENT_MATRIX_ARB:
{0.99960816, 0.010978992, -0.02574827, 0}
{0, 0.91986758, 0.39222905, 0}
{0.027991278, -0.39207536, 0.91950715, 0}
{249.30078, -64.625977, 4174.7188, 1}
GL_CURRENT_MATRIX_ARB:
{0.99992931, -0.004879978, 0.010840298, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.011888071, -0.41046464, 0.91179901, 0}
{-287.10938, -74.085938, 4218.2285, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_MODELVIEW_MATRIX:
{0.99992931, -0.004879978, 0.010840298, 0}
{0, 0.91186345, 0.41049367, 0}
{-0.011888071, -0.41046464, 0.91179901, 0}
{-287.10938, -74.085938, 4218.2285, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_CURRENT_MATRIX_ARB:
{0.99963969, 0.023475286, -0.013014656, 0}
{0, 0.48486927, 0.87458664, 0}
{0.026841579, -0.87427151, 0.48469457, 0}
{-215.40039, -576.11523, 6158.7266, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_MODELVIEW_MATRIX:
{0.99963969, 0.023475286, -0.013014656, 0}
{0, 0.48486927, 0.87458664, 0}
{0.026841579, -0.87427151, 0.48469457, 0}
{-215.40039, -576.11523, 6158.7266, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_CURRENT_MATRIX_ARB:
{0.99963969, 0.023475286, -0.013014656, 0}
{0, 0.48486927, 0.87458664, 0}
{0.026841579, -0.87427151, 0.48469457, 0}
{-215.40039, -576.11523, 6158.7266, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_MODELVIEW_MATRIX:
{0.99963969, 0.023475286, -0.013014656, 0}
{0, 0.48486927, 0.87458664, 0}
{0.026841579, -0.87427151, 0.48469457, 0}
{-215.40039, -576.11523, 6158.7266, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_CURRENT_MATRIX_ARB:
{0.99959737, -0.011129435, 0.026101092, 0}
{0, 0.91986758, 0.39222905, 0}
{-0.028374836, -0.39207113, 0.91949719, 0}
{-250.26758, -71.263672, 4190.2871, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_MODELVIEW_MATRIX:
{0.99959737, -0.011129435, 0.026101092, 0}
{0, 0.91986758, 0.39222905, 0}
{-0.028374836, -0.39207113, 0.91949719, 0}
{-250.26758, -71.263672, 4190.2871, 1}
GL_VIEWPORT: {4, 165, 512, 334}
GL_CURRENT_MATRIX_ARB:
{0.23925836, 0.38083714, -0.89315093, 0}
{0, 0.91986758, 0.39222905, 0}
{0.97095597, -0.093844078, 0.22008601, 0}
{2911.0664, 370.13428, 3481.4473, 1}
GL_PROJECTION_MATRIX:
{1.40625, -0, 0, 0}
{0, -2.1556885, 0, 0}
{0, -0, 1.0273149, 1}
{0, -0, -405.46298, 0}
GL_MODELVIEW_MATRIX:
{0.23925836, 0.38083714, -0.89315093, 0}
{0, 0.91986758, 0.39222905, 0}
{0.97095597, -0.093844078, 0.22008601, 0}
{2911.0664, 370.13428, 3481.4473, 1}
GL_VIEWPORT: {4, 165, 512, 334}
可以與他們做什麼?有沒有一種方法可以獲得相機的位置?或角色的全球位置?
我在想,會有一種方法來使用這些矩陣來獲取相機矩陣。 我正在閱讀:http://3dengine.org/Modelview_matrix 而且它說相機中心位於視口中間。這個遊戲總是這樣。 最後4行做了什麼?當我改變攝像機位置時,我的似乎會改變。 沒有辦法從我提供的信息中獲取相機的位置和外觀嗎? – Brandon 2012-08-07 13:34:41
嗨,你能告訴我GLIntercept的FreeCam是如何工作的嗎?它如何獲得相機的位置,以及它如何能夠移動它:S我正在嘗試做與GLintercept的Freecam相同的功能。 – Brandon 2012-08-07 16:06:27