#2594 closed defect (fixed)
Misaligned LOS texture
Reported by: | Philip Taylor | Owned by: | philip |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 17 |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description
See video from http://www.wildfiregames.com/forum/index.php?showtopic=18713
The LOS texture (as rendered onto both the minimap and the main view) appears to be skewed by 45 degrees - see in particular the angled ovals on the minimap, which should be circles.
Exactly the same effect can be reproduced if Renderer.cpp's glPixelStorei(GL_UNPACK_ALIGNMENT,1);
is changed to 2
. We pass an odd-sized array of bytes into glTexSubImage2D
, but it's being interpreted as if it was 1 byte wider (making it a multiple of 2), leading to that skewed pattern. But that shouldn't be happening when we set it to 1
.
I don't know whether there's a bug in the graphics drivers, or FRAPS, or some other process that wants to render some overlay inside GL applications, or possibly in the game itself (which seems unlikely since we only call glPixelStorei in one place). I've not seen anyone else report the same problem before.
We should be able to avoid this problem by only attempting to pass nicely-aligned arrays into glTexSubImage2D
. That's possibly helpful for performance too, since drivers may prefer aligned copies. It would be nice to understand exactly what conditions cause this failure, though.
Change History (3)
comment:1 by , 10 years ago
comment:3 by , 10 years ago
Milestone: | Backlog → Alpha 17 |
---|
I think the LOS texture should be the only one affected.
glTexSubImage2D
is also used byTerrainTextureOverlay
(which is not actually used by anything except the WIP pathfinder rewrite, and anyway the texture is usually 0.25/0.5/1/4 times the size of the map in tiles (which is a multiple of 16)); and byCMiniMap
(multiple of 16) andCTerritoryTexture
(multiple of 16).glTexImage2D
is only called with power-of-two sized textures, so anything >=4x4 is fine. Stride doesn't matter for 1x1 or 2x1. Hopefully we don't have any other 1xN or 2xN textures (though I haven't checked carefully). Compressed textures aren't affected by this.