Page 1 of 1
[26b] Fog of war bug when close to the map edge
Posted: Wed May 25, 2011 9:18 am
by jotwebe
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).

- tome-edge-bug.png (168.64 KiB) Viewed 1205 times
Re: [26b] Fog of war bug when close to the map edge
Posted: Wed May 25, 2011 4:06 pm
by Final Master
I'm not even sure what the hell the "Fog of War" even is.
Re: [26b] Fog of war bug when close to the map edge
Posted: Wed May 25, 2011 4:12 pm
by jotwebe
Final Master wrote:I'm not even sure what the hell the "Fog of War" even is.
The black stuff, where it's unexplored. Real-time strategy term. Other than that, it should be clear enough what the problem is, right?
Re: [26b] Fog of war bug when close to the map edge
Posted: Mon Aug 29, 2011 4:21 am
by tiger_eye
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
Posted: Mon Aug 29, 2011 6:20 pm
by tiger_eye
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);"