208 unsigned char mask1[8][256], mask2[4][256], mask4[2][256];
209 for (
int v = 0;
v < 256; ++
v) {
210 for (
int o = 0; o < 8; ++o)
211 mask1[o][
v] = ((
v >> o) % 2) * 255;
212 for (
int o = 0; o < 4; ++o)
213 mask2[o][
v] = (
int)((
v >> (2 * o)) % 4) * 255 / 3;
214 for (
int o = 0; o < 2; ++o)
215 mask4[o][
v] = (
int)((
v >> (4 * o)) % 16) * 255 / 15;
218 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
220 glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 256, 8, 0, GL_ALPHA, GL_UNSIGNED_BYTE, mask1);
222 glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 256, 4, 0, GL_ALPHA, GL_UNSIGNED_BYTE, mask2);
224 glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 256, 2, 0, GL_ALPHA, GL_UNSIGNED_BYTE, mask4);
239 throw GLException(
"Mask bitmap pixel format is not supported");
241 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
242 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
243 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
244 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLuint hMaskLookups[3]
texture containing mask values for 1, 2 and 4 bpp
@ QuaternaryMask
2 bits per pixel
@ BinaryMask
1 bit per pixel
@ HexMask
4 bits per pixel
JNIEnv jobject jint format
JNIEnv jlong jfloat jfloat jfloat v