mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:29:47 +02:00
Fix for distorted replaced textures.
This commit is contained in:
parent
1ea25db237
commit
c1c5991ac5
1 changed files with 6 additions and 1 deletions
|
@ -2188,13 +2188,15 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g
|
||||||
bufferPair.second.release();
|
bufferPair.second.release();
|
||||||
}
|
}
|
||||||
if (_heightTextureID == 0) {
|
if (_heightTextureID == 0) {
|
||||||
|
// we use non-aligned data for the various layers
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
glGenTextures(1, &_heightTextureID);
|
glGenTextures(1, &_heightTextureID);
|
||||||
glBindTexture(GL_TEXTURE_2D, _heightTextureID);
|
glBindTexture(GL_TEXTURE_2D, _heightTextureID);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
|
||||||
const QVector<quint16>& heightContents = node->getHeight()->getContents();
|
const QVector<quint16>& heightContents = node->getHeight()->getContents();
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_R16, width, height, 0,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_R16, width, height, 0,
|
||||||
GL_RED, GL_UNSIGNED_SHORT, heightContents.constData());
|
GL_RED, GL_UNSIGNED_SHORT, heightContents.constData());
|
||||||
|
@ -2241,6 +2243,9 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, &ZERO_VALUE);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, &ZERO_VALUE);
|
||||||
}
|
}
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
// restore the default alignment; it's what Qt uses for image storage
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
|
|
Loading…
Reference in a new issue