mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:05:08 +00:00

Textures are now initialized with a nullptr upon generation. They are only actually created once they are bound to a target. Currently only the GL_TEXTURE_2D target is supported. The software rasterizer now allows rendering with or without a bound TEXTURE_2D.
31 lines
866 B
C++
31 lines
866 B
C++
/*
|
|
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
|
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include "GLContext.h"
|
|
#include <LibGL/GL/gl.h>
|
|
|
|
extern GL::GLContext* g_gl_context;
|
|
|
|
void glGenTextures(GLsizei n, GLuint* textures)
|
|
{
|
|
g_gl_context->gl_gen_textures(n, textures);
|
|
}
|
|
|
|
void glDeleteTextures(GLsizei n, const GLuint* textures)
|
|
{
|
|
g_gl_context->gl_delete_textures(n, textures);
|
|
}
|
|
|
|
void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data)
|
|
{
|
|
g_gl_context->gl_tex_image_2d(target, level, internalFormat, width, height, border, format, type, data);
|
|
}
|
|
|
|
void glBindTexture(GLenum target, GLuint texture)
|
|
{
|
|
g_gl_context->gl_bind_texture(target, texture);
|
|
}
|