OpenGL ES 2.0 render to texture

后端 未结 4 1588
予麋鹿
予麋鹿 2020-12-15 08:25

I\'m trying to render to a texture using OpenGL ES 2.0, but I can\'t seem to make it work.

This is how I proceed:

    struct RenderTexture
    {
             


        
4条回答
  •  清歌不尽
    2020-12-15 09:01

    Make sure the texture is not bound before trying to render into it. Even if not using texturing at all, trying to render into a currently bound texture may invoke undefined behaviour and just not work.

    You should actually call glBindTexture(GL_TEXTURE_2D, 0) after the glTexImage2D in your RenderTexture constructor, or maybe restore the previously bound texture, like you do with the FBO. Just make sure the tex is not bound when you render into the FBO.

提交回复
热议问题