- gltextureunit_t *unit;
- CHECKGLERROR
- gl_state.unit = MAX_TEXTUREUNITS;
- gl_state.clientunit = MAX_TEXTUREUNITS;
- for (i = 0;i < MAX_TEXTUREUNITS;i++)
- {
- unit = gl_state.units + i;
- unit->t1d = 0;
- unit->t2d = 0;
- unit->t3d = 0;
- unit->tcubemap = 0;
- unit->arrayenabled = false;
- unit->arraycomponents = 0;
- unit->pointer_texcoord = NULL;
- unit->pointer_texcoord_buffer = 0;
- unit->pointer_texcoord_offset = 0;
- unit->rgbscale = 1;
- unit->alphascale = 1;
- unit->combinergb = GL_MODULATE;
- unit->combinealpha = GL_MODULATE;
- unit->texmatrixenabled = false;
- unit->matrix = identitymatrix;
- }
-
- for (i = 0;i < backendimageunits;i++)
- {
- GL_ActiveTexture(i);
- qglBindTexture(GL_TEXTURE_1D, 0);CHECKGLERROR
- qglBindTexture(GL_TEXTURE_2D, 0);CHECKGLERROR
- if (gl_texture3d)
- {
- qglBindTexture(GL_TEXTURE_3D, 0);CHECKGLERROR
- }
- if (gl_texturecubemap)
- {
- qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);CHECKGLERROR
- }
- }
-
- for (i = 0;i < backendarrayunits;i++)
- {
- GL_ClientActiveTexture(i);
- GL_BindVBO(0);
- qglTexCoordPointer(2, GL_FLOAT, sizeof(float[2]), NULL);CHECKGLERROR
- qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- }
-
- for (i = 0;i < backendunits;i++)
- {
- GL_ActiveTexture(i);
- qglDisable(GL_TEXTURE_1D);CHECKGLERROR
- qglDisable(GL_TEXTURE_2D);CHECKGLERROR
- if (gl_texture3d)
- {
- qglDisable(GL_TEXTURE_3D);CHECKGLERROR
- }
- if (gl_texturecubemap)
- {
- qglDisable(GL_TEXTURE_CUBE_MAP_ARB);CHECKGLERROR
- }
- qglMatrixMode(GL_TEXTURE);CHECKGLERROR
- qglLoadIdentity();CHECKGLERROR
- qglMatrixMode(GL_MODELVIEW);CHECKGLERROR
- if (gl_combine.integer)
- {
- qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_TEXTURE);CHECKGLERROR // for GL_INTERPOLATE_ARB mode
- qglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PREVIOUS_ARB);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_ARB, GL_CONSTANT_ARB);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_ARB, GL_SRC_ALPHA);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1);CHECKGLERROR
- qglTexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1);CHECKGLERROR
- }
- else
- {
- qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);CHECKGLERROR
- }
- CHECKGLERROR
- }
- CHECKGLERROR
-}
-
-void GL_Backend_ResetState(void)
-{
- memset(&gl_state, 0, sizeof(gl_state));