mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 01:27:44 +00:00
LibGL: Implement basic texture units
These are merely a way to hold the different texture target bind points that a texture can be bound to.
This commit is contained in:
parent
2b5732ab77
commit
52e5d3c961
4 changed files with 74 additions and 0 deletions
31
Userland/Libraries/LibGL/Tex/TextureUnit.h
Normal file
31
Userland/Libraries/LibGL/Tex/TextureUnit.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibGL/Tex/Texture2D.h>
|
||||
|
||||
namespace GL {
|
||||
|
||||
class TextureUnit {
|
||||
public:
|
||||
TextureUnit() = default;
|
||||
|
||||
void bind_texture_to_target(GLenum texture_target, const RefPtr<Texture>& texture);
|
||||
void unbind_texture(GLenum texture_target);
|
||||
const RefPtr<Texture>& get_bound_texture() const { return m_currently_bound_texture; }
|
||||
|
||||
GLenum currently_bound_target() const { return m_currently_bound_target; }
|
||||
bool is_bound() const { return m_currently_bound_texture != nullptr; }
|
||||
|
||||
private:
|
||||
RefPtr<Texture2D> m_texture_target_2d { nullptr };
|
||||
RefPtr<Texture> m_currently_bound_texture { nullptr };
|
||||
GLenum m_currently_bound_target;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue