checkerBoard is an IntBuffer which is the value given to pixels in the glTexImage2D function. I am filling out the pixel data with the expectations that the else part of the structure will be assigning bits in the order of R, G, B, A with 255, 255, 0 , 0 respectively. My results when using glTexImage2D give me a blue suggesting that the order is actually reverse of what I thought (A, B, G, R).
I've been searching for information about why this is so because the tutorial I am using has the pixel components in the RGBA order. This tutorial lesson 5 and c based from lazyfoo.net.
for (int i = 0; i < checkerBoardArray_PIXEL_COUNT; ++i) {
if ((i / 128 & 16 ^ i % 128 & 16) > 0) {
checkerBoard.put(i, 255);
checkerBoard.put(i, (checkerBoard.get(i) << 8) + 255);
checkerBoard.put(i, (checkerBoard.get(i) << 8) + 255);
checkerBoard.put(i, (checkerBoard.get(i) << 8) + 255);
} else {
checkerBoard.put(i, 255);
checkerBoard.put(i, (checkerBoard.get(i) << 8) + 255);
checkerBoard.put(i, (checkerBoard.get(i) << 8) + 0);
checkerBoard.put(i, (checkerBoard.get(i) << 8) + 0);
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);