glClear

glClear是現代詞,是一個專有名詞,指的是數學函式。

以下參考MSDN.
//函式原型
glClear
The glClear function clears buffers to preset values.
void glClear(
GLbitfield mask
);
//參數
Parameters
mask
Bitwise OR of masks that indicate the buffers to be cleared. The four masks are as follows. Mask Buffer to be Cleared 可以使用 | 運算符組合不同的緩衝標誌位,表明需要清除的緩衝,例如glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)表示要清除顏色緩衝以及深度緩衝
GL_COLOR_BUFFER_BIT The buffers currently enabled for color writing.
當前可寫的顏色緩衝
GL_DEPTH_BUFFER_BIT The depth buffer.
深度緩衝
GL_ACCUM_BUFFER_BIT The accumulation buffer.
累積緩衝
GL_STENCIL_BUFFER_BIT The stencil buffer.
模板緩衝
//注釋
Remarks
The glClear function sets the bitplane area of the window to values previously selected by glClearColor, glClearIndex, glClearDepth, glClearStencil, and glClearAccum. You can clear multiple color buffers simultaneously by selecting more than one buffer at a time using glDrawBuffer.
The pixel-ownership test, the scissor test, Dithering, and the buffer writemasks affect the operation of glClear. The scissor box bounds the cleared region. The alpha function, blend function, logical operation, stenciling, texture mapping, and z-buffering are ignored by glClear.
The glClear function takes a single argument (mask) that is the bitwise OR of several values indicating which buffer is to be cleared.
The value to which each buffer is cleared depends on the setting of the clear value for that buffer.
If a buffer is not present, a glClear call directed at that buffer has no effect.
The following functions retrieve information related to glClear:
glGet with argument GL_ACCUM_CLEAR_VALUE
glGet with argument GL_DEPTH_CLEAR_VALUE
glGet with argument GL_INDEX_CLEAR_VALUE
glGet with argument GL_COLOR_CLEAR_VALUE
glGet with argument GL_STENCIL_CLEAR_VALUE
以下參考機械工業出版社的《OpenGL編程指南》第五版p18-p20。
glClear()語句的作用是用當前緩衝區清除值,也就是glClearColor或者glClearDepth等函式所指定的值來清除指定的緩衝區。比如:
glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
第一條語句表示清除顏色設為黑色,第二條語句表示把整個視窗清除為當前的清除顏色,glClear()的唯一參數表示需要被清除的緩衝區。

相關詞條

相關搜尋

熱門詞條

聯絡我們