PDA

View Full Version : about 16bit texture



01-17-2001, 12:43 AM
I am working with a 16bit texture stored in a specified file format. The pixels are stored one by one, not compressed. The bit assign is 5-5-5-1. but when I use glTexImage2D(), there is always an error.
Here is my source:
glTexImage2D(GL_TEXTURE_2D, 0 GL_RGB5_A1, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
An illegal operaion error occur when this function runs.
I am not sure about the format and type parameter, should I set the type to GL_UNSIGNED_SHORT? I have tried, but the error remains.
Mycode works when operating 24b and 32bit texture with component set to 3 or 4.
I am using VC6.0, and the opengl library with this version of VC.
Can anyone help me?

Deiussum
01-17-2001, 09:07 AM
The first thing you should look at is how you are allocating the memory for your data. One of the biggest causes of exception errors stems from trying to read/write memory that has not been properly allocated.