TINYGL: fixing T texture cordinate

This commit is contained in:
Pawel Kolodziejski 2014-07-05 11:06:34 +02:00
parent e6924e894c
commit 5d65e40e1f
2 changed files with 2 additions and 4 deletions

View file

@ -42,7 +42,7 @@ void gl_transform_to_viewport(GLContext *c, GLVertex *v) {
// texture // texture
if (c->texture_2d_enabled) { if (c->texture_2d_enabled) {
v->zp.s = (int)(v->tex_coord.X * (ZB_POINT_S_MAX - ZB_POINT_S_MIN) + ZB_POINT_S_MIN); v->zp.s = (int)(v->tex_coord.X * (ZB_POINT_S_MAX - ZB_POINT_S_MIN) + ZB_POINT_S_MIN);
v->zp.t = (int)(v->tex_coord.Y * (ZB_POINT_S_MAX - ZB_POINT_S_MIN) + ZB_POINT_S_MIN); v->zp.t = (int)(v->tex_coord.Y * (ZB_POINT_T_MAX - ZB_POINT_T_MIN) + ZB_POINT_T_MIN);
} }
} }

View file

@ -65,9 +65,7 @@ FORCEINLINE static void putPixelMappingPerspective(FrameBuffer *buffer, int buf,
unsigned int &z, unsigned int &t, unsigned int &s, int &tmp, unsigned int &rgba, unsigned int &a, unsigned int &z, unsigned int &t, unsigned int &s, int &tmp, unsigned int &rgba, unsigned int &a,
int &dzdx, int &dsdx, int &dtdx, unsigned int &drgbdx, unsigned int dadx) { int &dzdx, int &dsdx, int &dtdx, unsigned int &drgbdx, unsigned int dadx) {
if (buffer->compareDepth(z, pz[_a])) { if (buffer->compareDepth(z, pz[_a])) {
unsigned ttt = (t & 0x003FC000) >> 5; int pixel = ((t & 0x3FC00000) | (s & 0x003FC000)) >> 14;
unsigned sss = (s & 0x003FC000) >> 13;
int pixel = ((ttt | sss) >> 1);
uint8 c_a, c_r, c_g, c_b; uint8 c_a, c_r, c_g, c_b;
uint32 *textureBuffer = (uint32 *)texture.getRawBuffer(pixel); uint32 *textureBuffer = (uint32 *)texture.getRawBuffer(pixel);
uint32 col = *textureBuffer; uint32 col = *textureBuffer;