FBO offscreen rendering slow

百般思念 提交于 2019-12-04 18:22:46

Here are a few things that may help with performance:

  • glClearColor() only needs to be called once in the init function.
  • Create the GLFloat arrays only once in the init function, store them in VBOs and use those to render. This avoids having to send all your vertex data down the bus to the GPU every frame.
  • Move the glEnableVertexAttribArray() calls to init, no need to keep on re-enabling them every frame.
  • In this case, you don't need to ever unbind the framebuffer. That also gets rid of the glBindFramebuffer() call at the beginning of draw.
  • Generate a VAO in init and use that to replace most of what remains of the draw method.

Also it would be nice if we could see your shaders. A lot of embedded systems aren't very fast with fragment shaders, your shaders could be the issue here.

Oh and when are you calling glUseProgram()?

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