MorePay
MorePay
采纳率0%
2018-12-14 13:09 阅读 992

关于opengl将灰度图绘制成地形的问题

如何将这种bmp文件的灰度图绘制为地形,24位深度,分辨率为282*190,
网上大多数给的是256*256的或者1024*1024,0.0.0.0.0萌新求助

```void readBitMapData(AUX_RGBImageRec *rawData, int nsize, unsigned char *pHeightMap)
{

for (int i = 0; i < nsize; i++)
{
    int gray;
    int rgb[3];

    rgb[0] = (int)(*(rawData->data + i * 3));
    rgb[1] = (int)(*(rawData->data + i * 3 + 1));
    rgb[2] = (int)(*(rawData->data + i * 3 + 2));
    gray = (int)(rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11);


    pHeightMap[i] = *(rawData->data+i*3);
}
//outputHex(pHeightMap);

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐