Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a difference between glClearColor(0.0,0.0,0.0,0.0) and glClear(COLOR_BUFFER_BIT)?

Tags:

opengl

Both clear the color buffer, right? Do they do it the same way?

like image 532
andandandand Avatar asked Nov 28 '10 09:11

andandandand


People also ask

What is 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.

What is the significance of fourth parameter in glClearColor 1.0 1.0 0.0 command?

The fourth parameter indicates the trasparency. The alpha is opacity, not transparency. This means that when it is 0, you can't see it at all.

What is clear color in opengl?

The glClearColor function specifies the red, green, blue, and alpha values used by glClear to clear the color buffers. Values specified by glClearColor are clamped to the range [0,1].


1 Answers

glClear is a Command: which clears the buffer.

glClearColor is State Setting: which sets the color value to buffer.

like image 151
user2110239 Avatar answered Oct 26 '22 17:10

user2110239