OpenGL读取灰度图生成地形

Posted 鲨鱼小猫

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenGL读取灰度图生成地形相关的知识,希望对你有一定的参考价值。

说明:地形高度,也就是高程是通过arcview获取

一、结果图

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

二、头文件

#ifndef _HEADER_H_
#define _HEADER_H_

#include <GL\\glut.h>

#define ncols         88
#define nrows         49
#define CELLSIZE  1000
#define xllcorner     -291908.345839
#define yllcorner     3154613.722214



int dem[nrows][ncols] = {
{4300, 4717, 4823, 4879, 4981, 4608, 4165, 3910, 4094, 4253, 4362, 4279, 4506, 4262, 4205, 4301, 3900, 3331, 3605, 3637, 3494, 3126, 2825, 2381, 1660, 1986, 2328, 2274, 2430, 2359, 2626, 3014, 3232, 3138, 3396, 3662, 4128, 4129, 4143, 4017, 4459, 4631, 4432, 4318, 3888, 3755, 3343, 2921, 2761, 2865, 2569, 2923, 3219, 3283, 2818, 2564, 2731, 3077, 3362, 3360, 3164, 2779, 2716, 2392, 2569, 2686, 2207, 2204, 1823, 2255, 2683, 2808, 2650, 2380, 2313, 2100, 2249, 1965, 1528, 1453, 1405, 1082, 994, 1139, 859, 850, 863, 1010},
{4186, 4351, 4637, 4963, 4851, 4356, 4072, 4172, 4386, 4334, 4466, 4445, 4724, 4691, 4455, 4114, 3735, 3741, 3967, 3581, 3021, 2546, 2203, 2079, 1616, 1764, 1831, 1989, 2203, 2387, 2950, 3315, 3445, 3316, 3654, 3930, 4251, 4378, 4335, 4266, 4241, 4844, 4769, 4512, 4355, 4060, 3525, 3105, 2779, 2581, 2493, 3042, 3236, 3126, 2782, 2523, 2695, 2956, 3169, 3457, 3088, 2478, 2307, 2169, 2250, 2288, 1981, 1761, 1886, 2338, 2436, 2357, 2285, 2166, 2415, 2587, 2426, 1876, 1691, 1503, 1316, 1151, 1135, 1065, 917, 821, 872, 1143},
{3786, 4145, 4742, 4730, 4823, 4493, 4338, 4302, 4566, 4536, 4558, 4726, 4872, 4740, 4247, 4079, 4213, 4120, 3812, 3246, 2691, 2488, 2478, 2142, 1652, 1575, 1937, 2136, 2081, 2376, 2694, 3020, 3515, 3548, 3832, 4110, 4532, 4530, 4510, 4633, 4355, 4667, 4865, 4808, 4507, 4210, 3861, 3469, 3008, 2689, 2451, 2732, 2734, 2892, 2854, 2611, 3012, 3113, 3374, 3366, 2954, 2550, 2177, 1959, 1969, 2089, 1722, 1793, 2165, 2100, 2119, 1935, 2057, 2278, 2407, 2543, 2351, 2064, 1887, 1659, 1294, 1274, 1263, 1127, 963, 888, 893, 1139},
{4026, 4363, 4566, 4817, 4852, 4673, 4663, 4620, 4535, 4543, 4542, 4759, 4563, 4417, 4356, 4486, 4346, 3923, 3418, 3091, 3146, 3062, 3071, 2648, 2064, 1665, 1605, 2158, 2391, 2434, 2562, 2888, 3154, 3630, 3839, 4191, 4505, 4719, 4755, 4652, 4403, 4438, 4569, 4740, 4357, 4024, 3891, 3540, 3047, 2922, 2496, 2383, 2673, 2963, 2935, 2450, 2730, 3023, 3385, 3117, 2727, 2440, 2292, 2283, 1924, 1761, 1740, 1591, 1801, 1737, 1877, 2150, 2487, 2528, 2746, 2651, 2421, 2116, 1727, 1508, 1422, 1427, 1252, 1033, 1001, 1041, 818, 969},
{3824, 4148, 4492, 4595, 4976, 4884, 5007, 4637, 4368, 4305, 4213, 4239, 4175, 4107, 4317, 4460, 4372, 3937, 3605, 3630, 3563, 3406, 2929, 2435, 2231, 1805, 1573, 2008, 2476, 2780, 2883, 3321, 3330, 3444, 3821, 4130, 4421, 4747, 4996, 4647, 4549, 4196, 4157, 4383, 4033, 3461, 3319, 3030, 2873, 2768, 2380, 2286, 2520, 2665, 2402, 2452, 2896, 3254, 3483, 3048, 2690, 2675, 2653, 2547, 2026, 2089, 1882, 1641, 1486, 1855, 2173, 2331, 2208, 2179, 2635, 2788, 2514, 2264, 2058, 1778, 1502, 1358, 1295, 1229, 1222, 1053, 815, 1067},
{3593, 3847, 4204, 4520, 4819, 5035, 4933, 4625, 4654, 4411, 3808, 3686, 3626, 3651, 3941, 4023, 4320, 4163, 4022, 3568, 3020, 2891, 2539, 2043, 1647, 1643, 1998, 2146, 2272, 2520, 2672, 3096, 3648, 3809, 3753, 4131, 4434, 4675, 4664, 4583, 4437, 3914, 3821, 4189, 3711, 3211, 2882, 2682, 2753, 2876, 2619, 2372, 2318, 2271, 2418, 2723, 3082, 3439, 3584, 3402, 3180, 3077, 3002, 2642, 2435, 2265, 2120, 2041, 1559, 1547, 1693, 1822, 2005, 2139, 2235, 2607, 2488, 2108, 1839, 1632, 1333, 1272, 1262, 1332, 1087, 1092, 1171, 919},
{3589, 3965, 4206, 4457, 4737, 5033, 5020, 4685, 4451, 4062, 4023, 3849, 3803, 3528, 3376, 3783, 4238, 4491, 4028, 3300, 2657, 2306, 2015, 1735, 1581, 1967, 2261, 2445, 2605, 2619, 2640, 3090, 3649, 4060, 3970, 4183, 4440, 4647, 4497, 4114, 4375, 3751, 3590, 3868, 3551, 3077, 2624, 2478, 2619, 2816, 2817, 2487, 2261, 2604, 2688, 2865, 3257, 3430, 3222, 2937, 2928, 3174, 3260, 3002, 2693, 2474, 2587, 2443, 1926, 1384, 1661, 1948, 1847, 1772, 2224, 2629, 2264, 1964, 1657, 1383, 1311, 1261, 1173, 1285, 1304, 1406, 1333, 1304},
{3461, 3825, 3909, 4148, 4599, 4844, 5014, 4666, 4337, 4491, 4406, 4207, 4188, 3757, 3511, 3332, 3703, 4105, 3940, 3468, 3172, 2782, 2240, 1678, 1585, 1757, 1829, 2125, 2489, 2741, 2780, 3295, 3599, 3863, 4171, 4140, 4463, 4594, 4127, 3775, 3956, 3814, 3270, 3363, 3198, 2842, 2428, 2374, 2582, 2489, 2608, 2195, 2223, 2582, 2892, 3116, 3397, 3029, 2648, 2478, 2755, 3088, 3205, 2850, 2501, 2256, 2401, 2198, 1898, 1336, 1641, 1691, 1479, 1906, 2309, 2466, 2179, 1986, 1655, 1508, 1387, 1287, 1120, 1239, 1397, 1351, 1311, 1332},
{3471, 3619, 3700, 4043, 4393, 4573, 4727, 4672, 4741, 4507, 4453, 4431, 4185, 4125, 3965, 3476, 3169, 3519, 3736, 3897, 3432, 2827, 2110, 1557, 1725, 2306, 2204, 1925, 2059, 2273, 2510, 2913, 3116, 3502, 4131, 4407, 4468, 4476, 3896, 3584, 3535, 3767, 3211, 3025, 3077, 2577, 2354, 2224, 2452, 2153, 2108, 2108, 2413, 2679, 2953, 3261, 3458, 3037, 2613, 2264, 2642, 2924, 3218, 2730, 2147, 1960, 2247, 1845, 1517, 1524, OpenGL读取灰度图生成地形

cinder读取灰度图生成三维地形

ue4读取灰度生成三维地形mesh

OpenGL高度图地形渲染不绘制

Unity 3D 使用高度图创建地形|| Unity 3D 使用笔刷绘制地形

根据OpenGL / DirectX中的道路轮廓进行地形变形