Iphone OpenGL ES 重用或绘制一次纹理场景
好的,我正在为 Iphone 使用 OpenGL 绘制图表。一切都很好,直到我使用 Texture2D 类来绘制 X 轴标签和 Y 轴标签。绘制标签的功能是在每一帧执行,我认为这很耗时。为了解决动画变慢的问题,我有两个想法,但我仍然找不到如何实现它们: 1.绘制标签1次,但下次重复使用它们,重复使用矩阵或纹理,如果有可能的话(抱歉我是新手,我可能会写一些不充分的东西); 2.当清理缓冲区(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT))时,仅清理屏幕的一部分,而不是整个渲染场景,我也很高兴知道是否有可能清除不是整个屏幕而是绘制的屏幕对象(例如在柱形图中,仅清除列,不清除背景,也不清除标签或图例)。 我非常感谢你的帮助。
Ok guys, so I am drawing charts in OpenGL for Iphone. And everything is ok, until I use that Texture2D class to draw X axis labels and Y axis labels. The function of drawing labels is executing at each frame which I think is time consuming. In order to solve animation slowing, I have 2 ideas, but I still can't find how could I implement them:
1. Draw the Labels 1 time, but next time just reuse them, reuse the matrix or the textures, if there is any possibility (sorry I am a newbie, I may write some not adequate stuff);
2. When cleaning the buffer (glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) clean just a part of the screen, not the whole Rendering scene, I would also be very happy to know if there is any possibility to clear not the whole screen but the drawn objects (for example in the Column chart, to clear just the columns, not the background and not the Labels, or lengend).
I would appreciate very much your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果每次都清除完整的渲染缓冲区,事情会变得更加简单并且更加顺利。只需将轴预渲染为单个纹理并在每次渲染时渲染该纹理即可。
Things will be much simpler and go far more smoothly if you clear the full render buffer every time. Just pre-render the axes into a single texture and render the texture on each pass.