Pregunta

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?

¿Fue útil?

Solución

As Andon M. Coleman recommended, I used raw binary format to store 16-bit height data and got the required result.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top