Ok, I'm abit lost here..
I need to create a texture from an unsigned short [256*256] array.
This is the same as a [256*256*2] byte array , I think..
I don't really understand how this works, since from what I can see only 2 pixel colors can be stored for the texture (wich is 256*256 pixels)
I can export the texture to a 16bit TGA, and when opening in photoshop it has the correct RGB values and displays correct.
when I export it I do: (after writing tga header)
fwrite((byte *)mMaterial[num]->mImage, sizeof(byte), 256*256*2, stream);
Where mMaterial[num]->mImage is a 256*256 unsigned short.
But this doesn't really have anything with my question to do, just some extra information
It's when I try to create a texture from this data I get problems.
I tried with:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16, 256,256,0, GL_RGB, GL_UNSIGNED_SHORT, mMaterial[num]->mImage);
But that creates a grayscale texture wich is tiled and combined with textures wich comes after the current in the source file.
Here's a screenshot that might explain better
And this is how the texture looks like after beeing exported to tga the way I said earlier, and this is what I would like to have in openGL aswell.
Thanks
return 1;
Edited by - panic on April 27, 2001 11:30:53 AM
Edited by - panic on April 27, 2001 11:33:14 AM