mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
move some code there and here
This commit is contained in:
parent
a7ad219261
commit
28b7713648
12 changed files with 84 additions and 76 deletions
|
|
@ -74,6 +74,18 @@ DrawContext::~DrawContext() {
|
|||
if (lineWidth != parent->lineWidth) {
|
||||
glLineWidth(parent->lineWidth);
|
||||
}
|
||||
|
||||
for (int i = 0; i < textures.size(); i++) {
|
||||
auto texture = parent->textures[i];
|
||||
if (textures[i] != texture) {
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
if (texture == nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
} else {
|
||||
texture->bind();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const glm::uvec2& DrawContext::getViewport() const {
|
||||
|
|
@ -154,3 +166,13 @@ void DrawContext::setLineWidth(float width) {
|
|||
lineWidth = width;
|
||||
glLineWidth(width);
|
||||
}
|
||||
|
||||
void DrawContext::useTexture(int target, const Bindable* texture) {
|
||||
glActiveTexture(GL_TEXTURE0 + target);
|
||||
if (texture == nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
} else {
|
||||
texture->bind();
|
||||
}
|
||||
textures.at(target) = texture;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue