History

Fix for distorted replaced textures.

Andrzej Kapolka committed 11 years ago

Commit c1c59911 parent 1ea25db1 file · +6 −1Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 1 file). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+6−1
@@ -2188,13 +2188,15 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g · 2187 unmodified lines
21882188 bufferPair.second.release();
21892189 }
21902190 if (_heightTextureID == 0) {
2191+ // we use non-aligned data for the various layers
2192+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
2193+
21912194 glGenTextures(1, &_heightTextureID);
21922195 glBindTexture(GL_TEXTURE_2D, _heightTextureID);
21932196 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
21942197 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
21952198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
21962199 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2197− glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
21982200 const QVector<quint16>& heightContents = node->getHeight()->getContents();
21992201 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16, width, height, 0,
22002202 GL_RED, GL_UNSIGNED_SHORT, heightContents.constData());
@@ -2241,6 +2243,9 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g · 40 unmodified lines
22412243 glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, &ZERO_VALUE);
22422244 }
22432245 glBindTexture(GL_TEXTURE_2D, 0);
2246+
2247+ // restore the default alignment; it's what Qt uses for image storage
2248+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
22442249 }
22452250
22462251 if (cursor) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t