Skip to content

Commit

Permalink
Fix ‘gl_lightmap 1’ with shader backend.
Browse files Browse the repository at this point in the history
Instead of swapping texture 0 with lightmap and disabling lightmapping,
bind white texture to texture 0. Also disable intensity bit. Fixes NVIDIA#210.
  • Loading branch information
skullernet authored and Paril committed Dec 10, 2021
1 parent 4fe459c commit 3a505ed
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/refresh/gl/tess.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,9 @@ void GL_BindArrays(void)

GL_VertexPointer(3, VERTEX_SIZE, ptr + 0);

if (gl_lightmap->integer) {
GL_TexCoordPointer(2, VERTEX_SIZE, ptr + 6);
} else {
GL_TexCoordPointer(2, VERTEX_SIZE, ptr + 4);
if (lm.nummaps) {
GL_LightCoordPointer(2, VERTEX_SIZE, ptr + 6);
}
GL_TexCoordPointer(2, VERTEX_SIZE, ptr + 4);
if (lm.nummaps) {
GL_LightCoordPointer(2, VERTEX_SIZE, ptr + 6);
}

GL_ColorBytePointer(4, VERTEX_SIZE, (GLubyte *)(ptr + 3));
Expand All @@ -289,6 +285,10 @@ void GL_Flush3D(void)
if (q_likely(tess.texnum[1])) {
state |= GLS_LIGHTMAP_ENABLE;
array |= GLA_LMTC;

if (q_unlikely(gl_lightmap->integer)) {
state &= ~GLS_INTENSITY_ENABLE;
}
}

if (!(state & GLS_TEXTURE_REPLACE)) {
Expand Down Expand Up @@ -366,15 +366,12 @@ void GL_DrawFace(mface_t *surf)
QGL_INDEX_TYPE *dst_indices;
int i, j;

if (q_unlikely(gl_lightmap->integer)) {
texnum[0] = surf->texnum[1];
if (!texnum[0])
texnum[0] = GL_TextureAnimation(surf->texinfo);
texnum[1] = 0;
if (q_unlikely(gl_lightmap->integer && surf->texnum[1])) {
texnum[0] = TEXNUM_WHITE;
} else {
texnum[0] = GL_TextureAnimation(surf->texinfo);
texnum[1] = surf->texnum[1];
}
texnum[1] = surf->texnum[1];

if (tess.texnum[0] != texnum[0] ||
tess.texnum[1] != texnum[1] ||
Expand Down

0 comments on commit 3a505ed

Please sign in to comment.