/* * Copyright (c) 2021, Jesse Buhagiar * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace GL { class TextureUnit { public: TextureUnit() = default; void bind_texture_to_target(GLenum texture_target, const RefPtr& texture); void unbind_texture(GLenum texture_target); RefPtr& bound_texture_2d() const { return m_texture_target_2d; } RefPtr& 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.is_null(); } void set_env_mode(GLenum mode) { m_env_mode = mode; } GLenum env_mode() const { return m_env_mode; } private: mutable RefPtr m_texture_target_2d { nullptr }; mutable RefPtr m_currently_bound_texture { nullptr }; GLenum m_currently_bound_target; GLenum m_env_mode { GL_MODULATE }; }; }