- if (backendunits > 1)
- {
- for (i = 0;i < backendunits;i++)
- {
- if (gl_state.texture[i] != mesh->textures[i])
- {
- if (gl_state.unit != i)
- {
- qglActiveTexture(GL_TEXTURE0_ARB + (gl_state.unit = i));CHECKGLERROR
- }
- if (gl_state.texture[i] == 0)
- {
- qglEnable(GL_TEXTURE_2D);CHECKGLERROR
- // have to disable texcoord array on disabled texture
- // units due to NVIDIA driver bug with
- // compiled_vertex_array
- if (gl_state.clientunit != i)
- {
- qglClientActiveTexture(GL_TEXTURE0_ARB + (gl_state.clientunit = i));CHECKGLERROR
- }
- qglEnableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- }
- qglBindTexture(GL_TEXTURE_2D, (gl_state.texture[i] = mesh->textures[i]));CHECKGLERROR
- if (gl_state.texture[i] == 0)
- {
- qglDisable(GL_TEXTURE_2D);CHECKGLERROR
- // have to disable texcoord array on disabled texture
- // units due to NVIDIA driver bug with
- // compiled_vertex_array
- if (gl_state.clientunit != i)
- {
- qglClientActiveTexture(GL_TEXTURE0_ARB + (gl_state.clientunit = i));CHECKGLERROR
- }
- qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- }
- }
- if (gl_state.texturergbscale[i] != mesh->texturergbscale[i])
- {
- if (gl_state.unit != i)
- {
- qglActiveTexture(GL_TEXTURE0_ARB + (gl_state.unit = i));CHECKGLERROR
- }
- qglTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, (gl_state.texturergbscale[i] = mesh->texturergbscale[i]));CHECKGLERROR
- }
- }
- }
- else
- {
- if (gl_state.texture[0] != mesh->textures[0])
- {
- if (gl_state.texture[0] == 0)
- {
- qglEnable(GL_TEXTURE_2D);CHECKGLERROR
- qglEnableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- }
- qglBindTexture(GL_TEXTURE_2D, (gl_state.texture[0] = mesh->textures[0]));CHECKGLERROR
- if (gl_state.texture[0] == 0)
- {
- qglDisable(GL_TEXTURE_2D);CHECKGLERROR
- qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- }
- }
- }
- if (gl_state.blendfunc1 != mesh->blendfunc1 || gl_state.blendfunc2 != mesh->blendfunc2)
- {
- qglBlendFunc(gl_state.blendfunc1 = mesh->blendfunc1, gl_state.blendfunc2 = mesh->blendfunc2);CHECKGLERROR
- if (gl_state.blendfunc2 == GL_ZERO)
- {
- if (gl_state.blendfunc1 == GL_ONE)
- {
- if (gl_state.blend)
- {
- gl_state.blend = 0;
- qglDisable(GL_BLEND);CHECKGLERROR
- }
- }
- else
- {
- if (!gl_state.blend)
- {
- gl_state.blend = 1;
- qglEnable(GL_BLEND);CHECKGLERROR
- }
- }
- }
- else
- {
- if (!gl_state.blend)
- {
- gl_state.blend = 1;
- qglEnable(GL_BLEND);CHECKGLERROR
- }
- }
- }
- if (gl_state.depthtest != mesh->depthtest)
- {
- gl_state.depthtest = mesh->depthtest;
- if (gl_state.depthtest)
- qglEnable(GL_DEPTH_TEST);
- else
- qglDisable(GL_DEPTH_TEST);
- }
- if (gl_state.depthmask != mesh->depthmask)
- {
- qglDepthMask(gl_state.depthmask = mesh->depthmask);CHECKGLERROR
+ float m[12], tempv[4], *v;
+ m[0] = backendmatrix.m[0][0];
+ m[1] = backendmatrix.m[0][1];
+ m[2] = backendmatrix.m[0][2];
+ m[3] = backendmatrix.m[0][3];
+ m[4] = backendmatrix.m[1][0];
+ m[5] = backendmatrix.m[1][1];
+ m[6] = backendmatrix.m[1][2];
+ m[7] = backendmatrix.m[1][3];
+ m[8] = backendmatrix.m[2][0];
+ m[9] = backendmatrix.m[2][1];
+ m[10] = backendmatrix.m[2][2];
+ m[11] = backendmatrix.m[2][3];
+ for (i = 0, v = varray_vertex;i < numverts;i++, v += 4)
+ {
+ VectorCopy(v, tempv);
+ v[0] = tempv[0] * m[0] + tempv[1] * m[1] + tempv[2] * m[2] + m[3];
+ v[1] = tempv[0] * m[4] + tempv[1] * m[5] + tempv[2] * m[6] + m[7];
+ v[2] = tempv[0] * m[8] + tempv[1] * m[9] + tempv[2] * m[10] + m[11];