1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 18:55:07 +00:00
serenity/Userland/Libraries/LibGL/Tex/TextureUnit.cpp
2021-12-01 10:21:13 +01:00

39 lines
877 B
C++

/*
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGL/GL/gl.h>
#include <LibGL/Tex/TextureUnit.h>
namespace GL {
void TextureUnit::bind_texture_to_target(GLenum texture_target, const RefPtr<Texture>& texture)
{
switch (texture_target) {
case GL_TEXTURE_2D:
m_texture_target_2d = static_ptr_cast<Texture2D>(texture);
m_currently_bound_target = GL_TEXTURE_2D;
m_currently_bound_texture = texture;
break;
default:
VERIFY_NOT_REACHED();
}
}
void TextureUnit::unbind_texture(GLenum texture_target)
{
switch (texture_target) {
case GL_TEXTURE_2D:
m_texture_target_2d = nullptr;
m_currently_bound_target = GL_NONE;
break;
default:
VERIFY_NOT_REACHED();
}
m_currently_bound_texture = nullptr;
}
}