1

我在搅拌机中创建了一个模型,并将其导出为 .obj 文件。为了让 open gl 渲染三角形,我相信坐标必须是逆时针的。搅拌器是否默认执行此操作,还是我需要编写一些代码来重新排序顶点?

模拟器屏幕截图

运行我的应用程序时,我得到以下信息。我认为这可能是因为顶点的顺序导致它们被剔除?

这是我的坐标

0.741670, 0.189542, 0.333219, 0.736962, 0.176234, 0.092931, 0.737054, -0.036978, 0.135064, 0.745167, -0.021633, 0.348303, 0.955526, 0.188491, 0.327129, 0.950747, 0.177176, 0.084729, 0.952274, -0.036216, 0.100027, 0.953441, -0.028794, 0.336081, 0.721120, 0.174601, -0.526814, 0.726614, -0.063783, -0.532670, 0.935062, 0.175649, -0.527249, 0.936101, -0.038258, -0.531152, 0.955526, 0.188491, 0.327129, 0.741670, 0.189542, 0.333219, 0.740995, -0.023997, 0.346373 , 0.953816, -0.026579, 0.335892, 0.950747, 0.177176, 0.084729, 0.735527, 0.176414, 0.119766, 0.737054, -0.036978, 0.135064, 0.952274, -0.036216, 0.100027, 0.124535, 0.198942, 0.348308, 0.125736, -0.026534, 0.372816, 0.117333, 0.181928 ,0.135162,0.115363,-0.034357,0.150613,0.091805,0.199118,0.349619,0.093005,0.026358,0.374127,0.374127,0.084603,0.1823,0.182104,0.1364,0.1364,0.1364,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4444444,44444,,0.1364 in721330, 0.207354, -0.745853, 0.720410, -0.006582, -0.747520, 0.726598, -0.033529, -0.533201, 0.727519, 0.180408, -0.531534, 0.934337, -0.158101, -0.750111, 0.940526, -0.185047, -0.535791, 0.941446, 0.028890, -0.534124, 0.721374, -0.645783, -0.751908, 0.723957, -0.647461, -0.537985, 0.935302, -0.646683, -0.754498, 0.937885, -0.648361, -0.540576, 0.934592, 0.209805, -0.741689, 0.720650, 0.208757, -0.741253, 0.721104 , 0.204856, -0.527345, 0.935046, 0.205904, -0.527780, 0.935631, -0.004102, -0.745592, 0.721689, -0.005150, -0.745156, 0.722144, -0.009051, -0.531248, 0.936086, -0.008003, -0.531683, 0.103302, 0.203762, - 0.746541, 0.105341, 0.210287, -0.519837, 0.103302, -0.010183, -0.746541, 0.102406, -0.012058, -0.529706, 0.720650, 0.208757, -0.741253, 0.720650, 0.208757, -0.741253, 0.721119, 0.206804, -0.525190, 0.721104, 0.204856, -0.527345, 0.934592,0.209805, -0.741689, 0.934577, 0.207857, -0.743844, 0.935046, 0.205904, -0.527780, 0.935046, 0.205904, -0.527780, 0.721374, -0.645783, -0.751908, 0.723957, -0.647461, -0.537985, 0.935302, -0.646683, -0.754498, 0.937885, -0.648361, -0.540576, 0.934592, 0.209805, -0.741689, 0.720650, 0.208757, -0.741253, 0.721104, 0.204856, -0.527345, 0.935046, 0.205904, -0.527780, 0.935631, -0.004102, -0.745592, 0.721689, -0.005150, - 0.745156, 0.722144, -0.009051, -0.531248, 0.936086, -0.008003, -0.531683, 0.103302, 0.203762, -0.746541, 0.105341, 0.210287, -0.519837, 0.103302, -0.010183, -0.746541, 0.102406, -0.012058, -0.529706, -0.986491 , 0.847652, 0.031098, -0.987709, 0.843956, -0.164961, -0.986318, 0.637021, -0.166461, -0.984346, 0.647845, 0.011650, -0.777551, 0.843796, 0.052705, -0.773801, 0.845320, -0.161202, -0.772410, 0.631385, -0.162702 , -0.776160, 0。629861, 0.051205, -0.976949, 0.848330, -0.778808, -0.975558, 0.634395, -0.780308, -0.763042, 0.849694, -0.775049, -0.761651, 0.635759, -0.776549, -0.966568, 0.824917, -0.172216, -0.719671, 0.847137, - 0.153942, -0.720530, 0.633195, -0.153342, -0.982316, 0.641381, -0.182278, -0.986363, 0.841550, 0.031924, -0.721447, 0.847745, 0.059995, -0.722306, 0.633803, 0.060595, -0.997095, 0.634657, 0.025697, -0.105714, 0.844402 , -0.136023, -0.104162, 0.632010, -0.133601, -0.107833, 0.846389, 0.077902, -0.109821, 0.634471, 0.082080, -0.114350, 0.016580, -0.128420, -0.112118, 0.230505, -0.130385, 0.101805, 0.228293, -0.128246, 0.099573 , 0.014368, -0.126281, -0.110643, 0.018567, 0.085505, -0.114237, 0.232492, 0.083540, 0.099686, 0.230280, 0.085680, 0.097454, 0.016355, 0.087644, -0.105714, 0.844402, -0.136023, 0.108209, 0.842190, -0.133884, -0.107833, 0.846389, 0。077902, 0.106090, 0.844177, 0.080041, -0.110643, -0.010183, 0.081361, -0.110643, -0.010183, -0.132584, 0.103302, -0.010183, -0.132584, 0.103302, -0.010183, 0.081361, -0.117934, 0.232671, 0.082464, -0.114864, 0.227828, -0.140563, 0.104356, 0.225305, -0.131726, 0.097681, 0.232683, 0.091157, -0.110643, -0.010183, -0.746541, 0.103302, -0.010183, -0.746541, -0.110643, 0.203762, -0.746541, 0.103302, 0.203762, -0.746541, -0.000131, 0.090791, -0.004629, -0.090885, -0.000973, 0.001877, -0.090871, -0.000419, 0.002596, 0.090902, -0.000181, -0.001123, 0.000109, 0.001963, -0.090888, 0.090878, 0.000484, -0.002330, 0.005764, -0.090706 , 0.001896, -0.000427, 0.090908, -0.000222, 0.003094, 0.007769, 0.090524, 0.000102, -0.090793, 0.004591, 0.090901, -0.000106, -0.001197, 0.003563, 0.004619, 0.090722, 0.003670, 0.009835, 0.090301, -0.002305, -0.006484, -0.090648, 0。000142, -0.090805, 0.004353, 0.000936, 0.090676, -0.006436, -0.090835, 0.000487, 0.003639, 0.000196, 0.090620, -0.007240, -0.003665, -0.006439, -0.090607, -0.000359, -0.090852, 0.003215, -0.090890, 0.000108, 0.001869, -0.090869, 0.000370, 0.002670, -0.000391, -0.090905, -0.000708, 0.000031, 0.090907, -0.000542, -0.000442, 0.090893, 0.001658, -0.090907, 0.000606, 0.000228, 0.000590, -0.090899, -0.001218, 0.000660, - 0.002871, 0.090861, 0.000484, 0.000830, -0.090904, -0.000454, 0.067440, -0.060960, -0.090907, -0.000198, 0.000644, -0.000454, 0.067439, -0.060961, 0.090908, -0.000465, -0.000202, 0.090908, -0.000453, -0.000201 , 0.090907, 0.000198, -0.000644, 0.001095, -0.001358, 0.090892, -0.001096, 0.001132, -0.090895, 0.000564, 0.090906, -0.000478, -0.090893, -0.000589, -0.001594, -0.005295, -0.090730, 0.002128, -0.013410, -0.004661,0.089794,-0。090902, -0.000832, 0.000807, 0.090893, 0.000580, 0.001597, 0.001593, 0.000648, -0.090893, 0.090893, 0.000580, 0.001597, -0.000905, -0.090904, -0.000145, -0.000591, 0.090905, 0.000637, -0.004675, 0.090701, -0.003982, 0.002779, -0.000640, -0.090864, -0.001368, -0.090888, -0.001371, -0.090349, 0.006450, -0.007735, 0.008350, 0.001805, -0.090507, -0.010526, -0.000917, 0.090293, 0.090894, -0.000068, 0.001646, -0.002918, 0.001039, 0.090856, -0.000060, -0.090907, 0.000648, 0.000319, 0.090907, -0.000548, -0.090908, -0.000286, 0.000340, 0.000900, -0.000844, -0.090901, 0.090900, -0.000940, 0.000909, -0.000961, -0.090900, 0.000848, -0.000913, 0.000832, 0.090901, 0.000948, 0.090900, -0.000835, -0.000900, 0.000844, 0.090901, 0.090900, -0.000940, 0.000909, -0.090900, 0.000940, -0.000909, -0.090881, -0.002185, -0.000614, 0.000000, -0.090909, -0.000000, 0.090895,0.000837, 0.001375, -0.001839, -0.002088, 0.090867, 0.000624, 0.090873, -0.002477, -0.000000, 0.000000, -0.090909, 0.000598, 0.090844, -0.003392, 0.090909, -0.000213, -0.000074, -0.090905, -0.000854, -0.000298

4

2 回答 2

1

经过进一步研究,您可以指定是否启用剔除禁用。您还可以指定是顺时针还是逆时针进行剔除。

于 2012-10-29T13:29:46.207 回答
1

Blender 的元素(索引)从 1 开始,但是 OpenGL 从 0 开始计数。从每个元素中减去 1。

于 2012-10-27T09:21:55.670 回答