Holes in textures
I have this in my draw method:
If I comment out the two, my textures do not show but with them uncommented, eveything shows correctly on the simulator but on the iPhone there are a bunch of white spots all over the place.
I assumed it could be that I'm passing complicated numbers for the texture coordinates.
I have a 1024x1024 sprite sheet and use the number: 0.015625 * (texture number row and column desired).
How I create my texture coordinates are like so:
Can anyone tell me why these "holes" are appearing?
EDIT:
Hole's do not appear when I use a 32x32 or any size sprite but DO appear when I use a 16x16/32x32 sprite from a larger sprite sheet say 128x128 to 1024x1024.
Any ideas?
Code:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);If I comment out the two, my textures do not show but with them uncommented, eveything shows correctly on the simulator but on the iPhone there are a bunch of white spots all over the place.
I assumed it could be that I'm passing complicated numbers for the texture coordinates.
I have a 1024x1024 sprite sheet and use the number: 0.015625 * (texture number row and column desired).
How I create my texture coordinates are like so:
Code:
typedef float TexCoords[2];
TexCoords mapTexCoords[1000];
- (void)setTexCoords:(TexCoords)t :(double)x :(double)y {
t[0] = x;
t[1] = y;
}Can anyone tell me why these "holes" are appearing?
EDIT:
Hole's do not appear when I use a 32x32 or any size sprite but DO appear when I use a 16x16/32x32 sprite from a larger sprite sheet say 128x128 to 1024x1024.
Any ideas?
I believe since your x's and y's are doubles, and your TexCoords are floats, you're going to lose precision. Currently you're using seven digits of precision, and floats only support six, so that could be your problem.
The above answer is pretty much a shot in the dark, by the way, but it might we worth trying
The above answer is pretty much a shot in the dark, by the way, but it might we worth trying
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
wyrmmage Wrote:Currently you're using seven digits of precision, and floats only support six, so that could be your problem.
This is inaccurate. Read about how floats work here: http://en.wikipedia.org/wiki/IEEE_754-1985
ah, right, my bad.
Well, you still should avoid assigning a double to a float.
Well, you still should avoid assigning a double to a float.
Worlds at War (Current Project) - http://www.awkward-games.com/forum/

