[BUG] glTexImage2D not attaching texture data

Started by aeonios, December 20, 2015, 15:04:15

Previous topic - Next topic

aeonios

Testing with LWJGL2 shows that my texture creation code and texture mapping code works properly, but in LWGJL3 the texture never shows up on screen. I initialized the texture using a buffer filled with Byte.MIN_VALUE (which for some unknown reason produces a gray color) to ensure that it wasn't an artifact of zero alpha, but I still get nothing. Drawing to the window buffer works fine, but drawing a texture to the window doesn't change anything (ie whatever was in the window buffer stays there). I tested with v2.9.3, the latest stable and the latest nightly, and both the latest stable and the latest nightly seem to have this issue.

Kai

Byte is a signed type in Java. Byte.MIN_VALUE is therefore -128 and not 0. And the bit pattern of -128 is 1000_0000. Interpreted as an UNSIGNED_BYTE this means 128 -> a mid-tone gray.
As for glTexImage2D, your LWJGL 2.x and LWJGL 3 version codes must differ significantly in the relevant OpenGL function calls, disregarding the differences in function suffixes and different window/display initialization between LWJGL 2.x and LWJGL 3.
Neither LWJGL 2.x nor LWJGL 3 are doing anything with those calls other than just forwarding them as they are to the driver.
As always: Build a single-file, self-contained Minimal Working Example to illustrate your problem.

aeonios

I've been copying the code rote from the v2 and v3 branches without modification. The only difference is in the window wrapper class, otherwise there's no difference in the GL code or the way it's called. All of the drawing code I've tested (aside from textures and FBO drawing) also work as expected both under LWJGL2 and LWJGL3 as long as I'm drawing directly to the window buffer. I guess I'll work on a self-contained example for this.

EDIT: and the stupid test magically works. Why does it hate me? I literally copied and pasted all of the code for the test out of my library in the same order it's called in >_<