Android OpenGL ES 2.0 : Can a GL_FLOAT texture be assigned to a FBO as a COLOR attachment?

自闭症网瘾萝莉.ら 提交于 2019-12-10 10:24:32

问题


I want to get the value using GL_FLOAT texture by glReadPixels.

My Android device support OES_texture_float. but, it became an error to attach GL_FLOAT texture.

In OpenGL ES 2.0 in Android, to attach GL_FLOAT texture to FBO is impossible? Or depend on hardware?

Part of my code is:

Init:

glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D,texture);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,texWidth,texHeight,0,GL_RGB,GL_FLOAT,NULL);

FBO Attach:

glBindFramebuffer(GL_FRAMEBUFFER,framebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,texture,0);
checkGlError("FBO Settings");
// glGetError() return 0x502.
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
// glCheckFramebufferStatus() return 0.

If anyone has some insight i'd ppreciate it.


回答1:


The unextended OpenGL ES 2.0 does not allow FBOs of this type, however there are some extensions (and some mobile GPUs) that supports floating point buffers. Take a look at GL_OES_texture_float and GL_NV_fbo_color_attachments.

nVidia Tegra 3 supports floating point FBOs.

P.S. With Tegra 2 it also seems to be possible: http://forums.developer.nvidia.com/devforum/discussion/1576/tegra-2-slow-floating-point-texture-operations/p1



来源:https://stackoverflow.com/questions/10675479/android-opengl-es-2-0-can-a-gl-float-texture-be-assigned-to-a-fbo-as-a-color-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!