0

I am trying to load a height map for terrain using SOIL. I use the following code:

unsigned char* image = SOIL_load_image(fname.c_str(), &width, &height, 0, SOIL_LOAD_L);

glBindTexture(GL_TEXTURE_2D, name);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, image);

However, my terrain looks steppy because the height is expressed with 8 bits only. How can I load 16-bit height map with SOIL? Or should I use another image library for this task?

4

1 回答 1

0

正如 Andon M. Coleman 建议的那样,我使用原始二进制格式存储 16 位高度数据并获得了所需的结果。

于 2014-04-27T17:40:31.870 回答