Glreadpixel Returns Zeros And Error 1282 (android)
Here is my picking code public static void pick(GL11 gl){ int[] viewport = new int[4]; ByteBuffer pixel = ByteBuffer.allocateDirect(3).order(ByteOrder.nativeOrder()
Solution 1:
When you're getting GL_INVALID_ENUM, that's probably because you're passing GL_RGB as format parameter to glReadPixels. According to the Khronos documentation for glReadPixels, there are only 2 possible pairs of values for format and type:
- GL_RGBA (format) and GL_UNSIGNED_BYTE (type)
- The values of GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES and GL_IMPLEMENTATION_COLOR_READ_TYPE_OES. You can query these using glGetIntegerv.
I ran into the same problem recently, and using GL_RGBA fixed it for me.
Post a Comment for "Glreadpixel Returns Zeros And Error 1282 (android)"