I’m having a heck of a time working with gldrawpixels! It works great if I use GL_UNSIGNED_BYTE, but if I use anything else (like GL_UNSIGNED_SHORT), I get nothing!!
I tried fiddling with the packing alignment and what not, all to no avail. It’s probably something stupid, but it’s driving me nuts!
If it works with GL_UNSIGNED_BYTE, then I assube the data is unsigned byte. So if you change the format to GL_UNSIGNED_SHORT, you also have to change the data to unsigned short. Did you do that?
That will only convert the pointer from unsigned char * to unsigned short*. It will not convert the data pointed to from unsigned char to unsigned short, and that is what OpenGL is expecting when you pass GL_UNSIGNED_SHORT instead of UNSIGNED_BYTE.
[This message has been edited by Bob (edited 02-10-2004).]
Originally posted by thafreak:
No my data is unsigned shorts.
<…>
Img[i] = foo[ i]%256;
Really?
Well, technically yes, but it’s no wonder you don’t see anything if your image data never goes above 255/65535 in intensity.
If you want full intensity from unsigned short values, you must use 65535, not 255. If you limit yourself to 255 maximum, why would you need unsigned shorts anyway!?
So if I do this and convert my shorts to bytes, I get an image, if I leave them as shorts I get all black!
I actually took one of the examples from the redbook called image.c and converted it to use unsigned shorts instead of unsigned bytes and I get the same results.
I can post my version of the image.c if anyone thinks that might help…