OpenGL:如何只清除屏幕的一部分? [英] OpenGL: How to clear only a part of the screen?

查看:1476
本文介绍了OpenGL:如何只清除屏幕的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用glClear()函数时是否可能无法清除整个屏幕?我需要清除屏幕的一部分,以节省一些渲染时间,否则我将不得不重画一半的屏幕每一帧,即使没有发生在另一半。

Is it possible to not clear entire screen when using glClear() function? I need to clear only a part of the screen to save some rendering time, otherwise i would have to redraw half of the screen every frame, even if nothing is happening on the other half.

当然,这应该像glClear()一样快(或快速)。

Of course this should be done as quickly (or quickier) as the glClear() is now.

推荐答案

可能想调查glScissor。从文档:

You might want to look into glScissor. From the documentation:


剪刀测试启用时,只有位于剪刀框中的像素可以通过绘制命令进行修改。

While scissor test is enabled, only pixels that lie within the scissor box can be modified by drawing commands.

这篇关于OpenGL:如何只清除屏幕的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆