riant09
riant09

Reputation: 121

What does gl.glClearColor do?

gl.glClearColor(0f, 0f, 0f, 1.0f);

How do I read it? As:

set clear color

or

clear the color

?

Upvotes: 12

Views: 9164

Answers (2)

Jerry Coffin
Jerry Coffin

Reputation: 490108

@Mikola's answer is correct, but I'll emphasize it a bit: calling glClearColor does not clear anything. It usually takes the value you've specified, and writes it to a register on the graphics card. Only later when you call glClear, with COLOR_BUFFER_BIT, does the buffer actually get cleared to the color you specified.

Upvotes: 24

Mikola
Mikola

Reputation: 9326

It sets the background color for when you call glClear.

Relevant man pages:

http://www.khronos.org/opengles/sdk/1.1/docs/man/glClear.xml

http://www.khronos.org/opengles/sdk/1.1/docs/man/glClearColor.xml

Upvotes: 9

Related Questions