--- gl_main.c.bak 2010-08-14 19:55:08.000000000 -0400
+++ gl_main.c 2010-08-14 21:33:10.000000000 -0400
@@ -2147,12 +2147,40 @@
* *
*****************/
+static void tfm(
+ GLfloat out[3],
+ const GLfloat mtx[16],
+ const GLfloat x,
+ const GLfloat y,
+ const GLfloat z)
+{
+ out[0] = mtx[0] * x;
+ out[1] = mtx[1] * x;
+ out[2] = mtx[2] * x;
+
+ out[0] += mtx[4] * y;
+ out[1] += mtx[5] * y;
+ out[2] += mtx[6] * y;
+
+ out[0] += mtx[8] * z;
+ out[1] += mtx[9] * z;
+ out[2] += mtx[10] * z;
+
+ out[0] += mtx[12];
+ out[1] += mtx[13];
+ out[2] += mtx[14];
+}
+
+
static void gld_DrawWall(GLWall *wall)
{
#if defined(OPENGLES)
GLfloat vtx[12];
- GLfloat tex[8];
+ GLfloat tex[16];
+ GLfloat mv[16];
+ GLfloat vtx_e[3];
#endif
+
if ( (!gl_drawskys) && (wall->flag>=GLDWF_SKY) )
wall->gltexture=NULL;
gld_BindTexture(wall->gltexture);
@@ -2175,26 +2203,44 @@
glTranslatef(wall->skyyaw,wall->skyymid,0.0f);
}
#if defined(OPENGLES)
vtx[0] = wall->glseg->x1; vtx[1] = wall->ytop; vtx[2] = wall->glseg->z1;
vtx[3] = wall->glseg->x1; vtx[4] = wall->ybottom; vtx[5] = wall->glseg->z1;
vtx[6] = wall->glseg->x2; vtx[7] = wall->ytop; vtx[8] = wall->glseg->z2;
vtx[9] = wall->glseg->x2; vtx[10] = wall->ybottom; vtx[11] = wall->glseg->z2;
+
+ glGetFloatv(GL_MODELVIEW_MATRIX, mv);
+
+ tfm(vtx_e, mv, vtx[0], vtx[1], vtx[2]);
+ tex[0] = vtx_e[0]; tex[1] = vtx_e[1]; tex[2] = 0.f; tex[3] = vtx_e[2];
+
+ tfm(vtx_e, mv, vtx[3], vtx[4], vtx[5]);
+ tex[4] = vtx_e[0]; tex[5] = vtx_e[1]; tex[6] = 0.f; tex[7] = vtx_e[2];
+
+ tfm(vtx_e, mv, vtx[6], vtx[7], vtx[8]);
+ tex[8] = vtx_e[0]; tex[9] = vtx_e[1]; tex[10] = 0.f; tex[11] = vtx_e[2];
+
+ tfm(vtx_e, mv, vtx[9], vtx[10], vtx[11]);
+ tex[12] = vtx_e[0]; tex[13] = vtx_e[1]; tex[14] = 0.f; tex[15] = vtx_e[2];
+
glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vtx);
+ glTexCoordPointer(4, GL_FLOAT, 0, tex);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
-#else
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+#else
glBegin(GL_TRIANGLE_STRIP);
glVertex3f(wall->glseg->x1,wall->ytop,wall->glseg->z1);
glVertex3f(wall->glseg->x1,wall->ybottom,wall->glseg->z1);
glVertex3f(wall->glseg->x2,wall->ytop,wall->glseg->z2);
glVertex3f(wall->glseg->x2,wall->ybottom,wall->glseg->z2);
glEnd();
#endif
if ( wall->gltexture )
{
glPopMatrix();