PDA

View Full Version : texturing using unsigned short array



svorre
12-09-2003, 10:42 PM
Hi,

I am trying to load a luminance texture using glTexImage3D.
I use the following peace of code:

glTexImage3D( GL_TEXTURE_3D, 0, GL_LUMINANCE8, h, w, d, 0,
GL_LUMINANCE, GL_UNSIGNED_BYTE, img);

The img variable is a pointer to an array of unsigned bytes,
which i created from an original image of unsigned shorts.

Now I want to try and create the texture directly from the
original. I thought I would be able to create it simply by
using the following code:

glTexImage3D( GL_TEXTURE_3D, 0, GL_LUMINANCE8, h, w, d, 0,
GL_LUMINANCE, GL_UNSIGNED_SHORT, original);

But when I do this the texture is completely black. Can anyone
tell me why this is?

Sincerely yours
svorre