mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibGL: Implement a basic OpenGL 1.x compatible library
This currently (obviously) doesn't support any actual 3D hardware, hence all calls are done via software rendering. Note that any modern constructs such as shaders are unsupported, as this driver only implements Fixed Function Pipeline functionality. The library is split into a base GLContext interface and a software based renderer implementation of said interface. The global glXXX functions serve as an OpenGL compatible c-style interface to the currently bound context instance. Co-authored-by: Stephan Unverwerth <s.unverwerth@gmx.de>
This commit is contained in:
parent
1424c4651f
commit
4807d32139
14 changed files with 920 additions and 0 deletions
31
Userland/Libraries/LibGL/GLUtils.cpp
Normal file
31
Userland/Libraries/LibGL/GLUtils.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue