Can anyone help me understand these texture coordinates?

Hi.

Imagine a very basic Texture atlas, looking roughly like this: (A and B are the 2 different pieces).

AAB
AA

Now, judging from this, piece A can be found at

[ left: 0.0f, bottom: 0.0f, right: 0.66667f, top: 1.0f ]

I have always imagined, and was sure that piece B could be found at

[ left: 0.66667f, bottom: 0.5f, right: 1.0f, top: 1.0f ]

However, that’s not coming out right at all. Piece B IS coming out right at

[ left: 0.66667f, bottom: 0.0f, right: 1.0f, top: 0.5f ]

however.

I render as triangles, and my data for rendering B looks like this:

Vertexbuffer

float[] {
                       x - 64, y + 64, // top left
		       x - 64, y - 64, // bottom left
		       x + 64, y - 64, // bottom right
                       x + 64, y + 64 // top right
                  }

Texturebuffer (doesnt work, but what I thought was correct)

float[] {
                       0.66667f, 1.0f,
		       0.66667f, 0.5f,
		       1.0f,0.5f,
		       1.0f,1.0f
                   }

Texturebuffer (works, but what I thought was wrong)

float[] { 
                       0.66667f, 0.5f,
		       0.66667f, 0.0f,
		       1.0f,0.0f,
		       1.0f,0.5f
                   }

I hope my question is understandable, and that someone can explain to me what’s going on here.

Ok, I should have tried this first of course, rendering the entire Atlas… The entire texture is flipped vertically, so that explains the weird texture coordinates.

I was just going to say that. xD