mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWeb/WebGL: Reimplement OpenGLContext::clear_buffer_to_default_values
The implementation was removed with the migration to ANGLE. This reimplements it. This is required by Stimulation Clicker on neal.fun, which does not clear the framebuffer itself, instead relying on the browser doing it.
This commit is contained in:
parent
dbf52a1b5f
commit
13f28cb941
Notes:
github-actions[bot]
2025-02-09 00:02:06 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/13f28cb941e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3385
1 changed files with 26 additions and 0 deletions
|
@ -123,6 +123,32 @@ void OpenGLContext::notify_content_will_change()
|
|||
|
||||
void OpenGLContext::clear_buffer_to_default_values()
|
||||
{
|
||||
#ifdef AK_OS_MACOS
|
||||
Array<GLfloat, 4> current_clear_color;
|
||||
glGetFloatv(GL_COLOR_CLEAR_VALUE, current_clear_color.data());
|
||||
|
||||
GLfloat current_clear_depth;
|
||||
glGetFloatv(GL_DEPTH_CLEAR_VALUE, ¤t_clear_depth);
|
||||
|
||||
GLint current_clear_stencil;
|
||||
glGetIntegerv(GL_STENCIL_CLEAR_VALUE, ¤t_clear_stencil);
|
||||
|
||||
// The implicit clear value for the color buffer is (0, 0, 0, 0)
|
||||
glClearColor(0, 0, 0, 0);
|
||||
|
||||
// The implicit clear value for the depth buffer is 1.0.
|
||||
glClearDepthf(1.0f);
|
||||
|
||||
// The implicit clear value for the stencil buffer is 0.
|
||||
glClearStencil(0);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
// Restore the clear values.
|
||||
glClearColor(current_clear_color[0], current_clear_color[1], current_clear_color[2], current_clear_color[3]);
|
||||
glClearDepthf(current_clear_depth);
|
||||
glClearStencil(current_clear_stencil);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGLContext::allocate_painting_surface_if_needed()
|
||||
|
|
Loading…
Add table
Reference in a new issue