[26b] Fog of war bug when close to the map edge
Moderator: Moderator
[26b] Fog of war bug when close to the map edge
When moving close to the edge of a map with fog of war, the fog of war on the opposite side of the map is lifted. As seen in the attached image (circled with red).
Ghoul never existed, this never happened!
-
- Sher'Tul
- Posts: 1022
- Joined: Fri May 21, 2010 8:16 pm
- Location: Inside the minds of all
- Contact:
Re: [26b] Fog of war bug when close to the map edge
I'm not even sure what the hell the "Fog of War" even is.
Final Master's Character Guides
Final Master's Guide to the Arena
Edge: Final Master... official Tome 4 (thread) necromancer.
Zonk: I'd rather be sick than on fire! :D
Final Master's Guide to the Arena
Edge: Final Master... official Tome 4 (thread) necromancer.
Zonk: I'd rather be sick than on fire! :D
Re: [26b] Fog of war bug when close to the map edge
The black stuff, where it's unexplored. Real-time strategy term. Other than that, it should be clear enough what the problem is, right?Final Master wrote:I'm not even sure what the hell the "Fog of War" even is.
Ghoul never existed, this never happened!
Re: [26b] Fog of war bug when close to the map edge
This still happens, and I think the fix really is this easy (change GL_REPEAT to GL_CLAMP):
Code: Select all
Index: src/map.c
===================================================================
--- src/map.c (revision 4287)
+++ src/map.c (working copy)
@@ -545,8 +545,8 @@
glGenTextures(1, &(map->seens_texture));
printf("C Map seens texture: %d (%dx%d)\n", map->seens_texture, map->w, map->h);
tglBindTexture(GL_TEXTURE_2D, map->seens_texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 4, map->w, map->h, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
map->seens_map = calloc((map->w)*(map->h)*4, sizeof(GLubyte));
Re: [26b] Fog of war bug when close to the map edge
whoops, i meant that to be changed from GL_REPEAT to GL_CLAMP_TO_EDGE
Alternatively, GL_CLAMP should work fine if the border color is correctly set via "GLint borderColor[4] = {0, 0, 0, 255}; glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);"
Alternatively, GL_CLAMP should work fine if the border color is correctly set via "GLint borderColor[4] = {0, 0, 0, 255}; glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);"