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
2188 bufferPair.second.release();2188 bufferPair.second.release();
2189 }2189 }
2190 if (_heightTextureID == 0) {2190 if (_heightTextureID == 0) {
2191 // we use non-aligned data for the various layers
2192 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
2193
2191 glGenTextures(1, &_heightTextureID);2194 glGenTextures(1, &_heightTextureID);
2192 glBindTexture(GL_TEXTURE_2D, _heightTextureID);2195 glBindTexture(GL_TEXTURE_2D, _heightTextureID);
2193 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);2196 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2194 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);2197 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2195 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);2198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
2196 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);2199 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2197 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
2198 const QVector<quint16>& heightContents = node->getHeight()->getContents();2200 const QVector<quint16>& heightContents = node->getHeight()->getContents();
2199 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16, width, height, 0,2201 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16, width, height, 0,
2200 GL_RED, GL_UNSIGNED_SHORT, heightContents.constData());2202 GL_RED, GL_UNSIGNED_SHORT, heightContents.constData());
@@ -2241,6 +2243,9 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g · 40 unmodified lines
2241 glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, &ZERO_VALUE);2243 glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, &ZERO_VALUE);
2242 }2244 }
2243 glBindTexture(GL_TEXTURE_2D, 0);2245 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);
2244 }2249 }
2245 2250
2246 if (cursor) {2251 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