[26b] Fog of war bug when close to the map edge

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
jotwebe
Uruivellas
Posts: 725
Joined: Fri Apr 15, 2011 6:58 am
Location: GMT+1

[26b] Fog of war bug when close to the map edge

#1 Post 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
tome-edge-bug.png (168.64 KiB) Viewed 1197 times
Ghoul never existed, this never happened!

Final Master
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

#2 Post by Final Master »

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

jotwebe
Uruivellas
Posts: 725
Joined: Fri Apr 15, 2011 6:58 am
Location: GMT+1

Re: [26b] Fog of war bug when close to the map edge

#3 Post 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?
Ghoul never existed, this never happened!

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: [26b] Fog of war bug when close to the map edge

#4 Post 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));

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: [26b] Fog of war bug when close to the map edge

#5 Post 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);"

Post Reply