mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00

This implements `glGetError` and correctly sets the state machine's error macro (similar to LibC `errno`) when an invalid operation is performed. This is reset on completion of a successful operation.
36 lines
741 B
C++
36 lines
741 B
C++
/*
|
|
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
|
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@gmx.de>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include "GL/gl.h"
|
|
#include "GLContext.h"
|
|
|
|
extern GL::GLContext* g_gl_context;
|
|
|
|
void glClear(GLbitfield mask)
|
|
{
|
|
g_gl_context->gl_clear(mask);
|
|
}
|
|
|
|
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
|
|
{
|
|
g_gl_context->gl_clear_color(red, green, blue, alpha);
|
|
}
|
|
|
|
GLubyte* glGetString(GLenum name)
|
|
{
|
|
return g_gl_context->gl_get_string(name);
|
|
}
|
|
|
|
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
|
|
{
|
|
g_gl_context->gl_viewport(x, y, width, height);
|
|
}
|
|
|
|
GLenum glGetError()
|
|
{
|
|
return g_gl_context->gl_get_error();
|
|
}
|