Subversion Repositories eduke32

Rev

Rev 8712 | Rev 8714 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8712 Rev 8713
Line 611... Line 611...
611
    if (videoGetRenderMode() != REND_POLYMOST)
611
    if (videoGetRenderMode() != REND_POLYMOST)
612
        return;
612
        return;
613
613
614
    polymost_outputGLDebugMessage(3, "polymost_disableProgram()");
614
    polymost_outputGLDebugMessage(3, "polymost_disableProgram()");
615
615
616
    useShaderProgram(0);
616
    polymost_useShaderProgram(0);
617
}
617
}
618
618
619
void polymost_resetProgram()
619
void polymost_resetProgram()
620
{
620
{
621
    if (videoGetRenderMode() != REND_POLYMOST)
621
    if (videoGetRenderMode() != REND_POLYMOST)
622
        return;
622
        return;
623
623
624
    polymost_outputGLDebugMessage(3, "polymost_resetProgram()");
624
    polymost_outputGLDebugMessage(3, "polymost_resetProgram()");
625
625
626
    if (r_enablepolymost2)
626
    if (r_enablepolymost2)
627
        useShaderProgram(polymost2BasicShaderProgramID);
627
        polymost_useShaderProgram(polymost2BasicShaderProgramID);
628
    else
628
    else
629
        useShaderProgram(polymost1CurrentShaderProgramID);
629
        polymost_useShaderProgram(polymost1CurrentShaderProgramID);
630
630
631
    // ensure that palswapTexture and paletteTexture[curbasepal] is bound
631
    // ensure that palswapTexture and paletteTexture[curbasepal] is bound
632
    glActiveTexture(GL_TEXTURE1);
632
    glActiveTexture(GL_TEXTURE1);
633
    glBindTexture(GL_TEXTURE_2D, palswapTextureID);
633
    glBindTexture(GL_TEXTURE_2D, palswapTextureID);
634
    glActiveTexture(GL_TEXTURE2);
634
    glActiveTexture(GL_TEXTURE2);
Line 639... Line 639...
639
static void polymost_setCurrentShaderProgram(uint32_t programID)
639
static void polymost_setCurrentShaderProgram(uint32_t programID)
640
{
640
{
641
    polymost_outputGLDebugMessage(3, "polymost_setCurrentShaderProgram(programID:%u)", programID);
641
    polymost_outputGLDebugMessage(3, "polymost_setCurrentShaderProgram(programID:%u)", programID);
642
642
643
    polymost1CurrentShaderProgramID = programID;
643
    polymost1CurrentShaderProgramID = programID;
644
    useShaderProgram(programID);
644
    polymost_useShaderProgram(programID);
645
645
646
    //update the uniform locations
646
    //update the uniform locations
647
    polymost1TexSamplerLoc = glGetUniformLocation(polymost1CurrentShaderProgramID, "s_texture");
647
    polymost1TexSamplerLoc = glGetUniformLocation(polymost1CurrentShaderProgramID, "s_texture");
648
    polymost1PalSwapSamplerLoc = glGetUniformLocation(polymost1CurrentShaderProgramID, "s_palswap");
648
    polymost1PalSwapSamplerLoc = glGetUniformLocation(polymost1CurrentShaderProgramID, "s_palswap");
649
    polymost1PaletteSamplerLoc = glGetUniformLocation(polymost1CurrentShaderProgramID, "s_palette");
649
    polymost1PaletteSamplerLoc = glGetUniformLocation(polymost1CurrentShaderProgramID, "s_palette");
Line 919... Line 919...
919
    polymost_setTexturePosSize(texturePosSize);
919
    polymost_setTexturePosSize(texturePosSize);
920
    polymost_setHalfTexelSize(halfTexelSize);
920
    polymost_setHalfTexelSize(halfTexelSize);
921
    glBindTexture(GL_TEXTURE_2D, pPth->glpic);
921
    glBindTexture(GL_TEXTURE_2D, pPth->glpic);
922
}
922
}
923
923
924
void useShaderProgram(uint32_t shaderID)
924
void polymost_useShaderProgram(uint32_t shaderID)
925
{
925
{
926
    if (currentShaderProgramID != shaderID)
926
    if (currentShaderProgramID != shaderID)
927
        glUseProgram(shaderID);
927
        glUseProgram(shaderID);
928
    currentShaderProgramID = shaderID;
928
    currentShaderProgramID = shaderID;
929
}
929
}
Line 1162... Line 1162...
1162
    polymost_setPalswapSize(256, numshades+1);
1162
    polymost_setPalswapSize(256, numshades+1);
1163
    polymost_setCurrentShaderProgram(polymost1BasicShaderProgramID);
1163
    polymost_setCurrentShaderProgram(polymost1BasicShaderProgramID);
1164
    glUniform1i(polymost1TexSamplerLoc, 0);
1164
    glUniform1i(polymost1TexSamplerLoc, 0);
1165
    glUniform1i(polymost1PalSwapSamplerLoc, 1);
1165
    glUniform1i(polymost1PalSwapSamplerLoc, 1);
1166
    glUniform1i(polymost1PaletteSamplerLoc, 2);
1166
    glUniform1i(polymost1PaletteSamplerLoc, 2);
1167
    useShaderProgram(0);
1167
    polymost_useShaderProgram(0);
1168
1168
1169
    lastbasepal = -1;
1169
    lastbasepal = -1;
1170
    for (int basepalnum = 0; basepalnum < MAXBASEPALS; ++basepalnum)
1170
    for (int basepalnum = 0; basepalnum < MAXBASEPALS; ++basepalnum)
1171
    {
1171
    {
1172
        paletteTextureIDs[basepalnum] = 0;
1172
        paletteTextureIDs[basepalnum] = 0;
Line 2885... Line 2885...
2885
    glEnable(GL_BLEND);
2885
    glEnable(GL_BLEND);
2886
    glEnable(GL_ALPHA_TEST);
2886
    glEnable(GL_ALPHA_TEST);
2887
2887
2888
    handle_blend((dameth & DAMETH_MASKPROPS) > DAMETH_MASK, drawpoly_blend, (dameth & DAMETH_MASKPROPS) == DAMETH_TRANS2);
2888
    handle_blend((dameth & DAMETH_MASKPROPS) > DAMETH_MASK, drawpoly_blend, (dameth & DAMETH_MASKPROPS) == DAMETH_TRANS2);
2889
2889
2890
    useShaderProgram(polymost2BasicShaderProgramID);
2890
    polymost_useShaderProgram(polymost2BasicShaderProgramID);
2891
2891
2892
    //POGOTODO: batch uniform binding
2892
    //POGOTODO: batch uniform binding
2893
    float tint[4] = {1.0f, 1.0f, 1.0f, 1.0f};
2893
    float tint[4] = {1.0f, 1.0f, 1.0f, 1.0f};
2894
    polytint_t const & polytint = hictinting[globalpal];
2894
    polytint_t const & polytint = hictinting[globalpal];
2895
    //POGOTODO: full bright pass uses its own globalshade...
2895
    //POGOTODO: full bright pass uses its own globalshade...