3

I'm trying to load a 2 channel, unsigned char texture using glTexImage2D with the following code (using the NDK, but I don't think that would make much of a difference here):

glTexImage2D(GL_TEXTURE_2D, 0, GL_RG32F, width >> 1, height >> 1, 0, GL_RG, GL_UNSIGNED_BYTE, textureData);

This works great on a number of different Android devices going back to at least Android 19 (KitKat). But on devices with Snapdragon cores (Nexus 6P for example) in them, the call fails and the error is GL error 0x502 (GL_INVALID_OPERATION).

I've found the Qualcomm Adreno OpenGL ES Developer Guide online and it says that GL_RG32F is a supported internal format. I've also tried various other internal formats all with similar levels of failure.

I've also tested with using GL_LUMINANCE for both the internal format and format parameters, and I am able to load the texture successfully with no other changes (with the obvious issue of missing half my texture data in this case).

I would like to avoid separating this texture data on the CPU and loading it as two separate textures, but I'm struggling to come up with a way to avoid that.

Am I missing something obvious here? Or is GL_RG just not something that I can use on these devices?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Dennis Munsie
  • 1,211
  • 12
  • 24

1 Answers1

0

So in my case, it turned out that I needed to use GL_RG8 as the internal format rather than GL_RG32F. Once I made that change, the GL_INVALID_OPERATION errors went away and the device started performing as intended.

Dennis Munsie
  • 1,211
  • 12
  • 24