I think you are almost there, but it's unclear why some other also have offset. Like peds:
Right side has offset:
In my friends renderer he deals with "alignment"
He draws peds with alignment like this:
Code:
if (align){ VBO.Add(Vector3f(pos.x+w/2,pos.y+h/2,pos.z),Vector2f(texEntry->U2,texEntry->V2));
VBO.Add(Vector3f(pos.x+w/2,pos.y-h/2,pos.z),Vector2f(texEntry->U2,texEntry->V1));
VBO.Add(Vector3f(pos.x-w/2,pos.y-h/2,pos.z),Vector2f(texEntry->U1,texEntry->V1));
VBO.Add(Vector3f(pos.x+w/2,pos.y+h/2,pos.z),Vector2f(texEntry->U2,texEntry->V2));
VBO.Add(Vector3f(pos.x-w/2,pos.y-h/2,pos.z),Vector2f(texEntry->U1,texEntry->V1));
VBO.Add(Vector3f(pos.x-w/2,pos.y+h/2,pos.z),Vector2f(texEntry->U1,texEntry->V2));
}
He does some addition and dividing. "Pos" struct is (X,Y,Z) position to draw ped at, "W" is ped sprite width (NPOT).
I should try to make minimal app with this VBO and use my texture, maybe it actually solve this.
Im not sure.
EDIT
Ok, i think you are correct that this actually should be like this.
if you look at the ped above, it's centered. I tried some other peds and objects.
They seem to be centered enough.
I think that's it. It's just supposed to be like that.
Another ex:
Black borders but c. car is centered:
Thank you for helping.
Bookmarks