Support binding a texture to a specific texture unit
This commit is contained in:
parent
1d71954394
commit
b8bf80e84e
1 changed files with 8 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ namespace psemek::gfx
|
|||
void reset();
|
||||
|
||||
void bind() const;
|
||||
void bind(int texture_unit) const;
|
||||
|
||||
geom::vector<std::size_t, D> size() const { return size_; }
|
||||
|
||||
|
|
@ -208,6 +209,13 @@ namespace psemek::gfx
|
|||
gl::BindTexture(Target, id());
|
||||
}
|
||||
|
||||
template <std::size_t D, GLenum Target>
|
||||
void basic_texture<D, Target>::bind(int texture_unit) const
|
||||
{
|
||||
gl::ActiveTexture(gl::TEXTURE0 + texture_unit);
|
||||
gl::BindTexture(Target, id());
|
||||
}
|
||||
|
||||
template <std::size_t D, GLenum Target>
|
||||
std::size_t basic_texture<D, Target>::width() const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue