Search code examples
opengl-eshdr

Is HDR rendering possible in OpenGL es?


I'm NOT talking about actually rendering to HDR diplays here.

I'm trying to get my game to look better and one of the ways I've found online is to use an HDR pipeline in post-processing. According to this tutorial, to accomplish this, you need to render to a framebuffer with a texture that's set to an internal format of GL_RGB16f, GL_RGBA16, GL_RGB32F or GL_RGBA32F. Unfortunatly, I looked in the OpenGL es 3.0 docs, and it tells me (at page 132) that there is no floating-point type internal format that is color-renderable, which leads to a non-complete frameBuffer. Am I oblivious to something very obvious, or is an HDR pipline in OpenGL es 3.0 impossible?


Solution

  • I Got it working by generating the Texture this way:

    FloatBuffer floatBuffer = ByteBuffer.allocateDirect(w * h * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    //allocateDirect( width * height * ComponentNumber * bitPerFloat)
    GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D, 0, GLES30.GL_RGBA16F, w, h, 0, GLES30.GL_RGBA, GLES30.GL_FLOAT, floatBuffer);