mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- fixed: FMaterial's tex pointer could be accessed before it was set.
- allow more than two texture units in shaders.
This commit is contained in:
parent
9b8869e78d
commit
c6f4c0b6f0
2 changed files with 9 additions and 3 deletions
|
@ -227,8 +227,14 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
|
||||
glUseProgram(hShader);
|
||||
|
||||
tempindex = glGetUniformLocation(hShader, "texture2");
|
||||
if (tempindex > 0) glUniform1i(tempindex, 1);
|
||||
// set up other texture units (if needed by the shader)
|
||||
for (int i = 2; i<16; i++)
|
||||
{
|
||||
char stringbuf[20];
|
||||
mysnprintf(stringbuf, 20, "texture%d", i);
|
||||
tempindex = glGetUniformLocation(hShader, stringbuf);
|
||||
if (tempindex > 0) glUniform1i(tempindex, i - 1);
|
||||
}
|
||||
|
||||
glUseProgram(0);
|
||||
return !!linked;
|
||||
|
|
|
@ -405,6 +405,7 @@ int FMaterial::mMaxBound;
|
|||
FMaterial::FMaterial(FTexture * tx, bool expanded)
|
||||
{
|
||||
mShaderIndex = 0;
|
||||
tex = tx;
|
||||
|
||||
// TODO: apply custom shader object here
|
||||
/* if (tx->CustomShaderDefinition)
|
||||
|
@ -495,7 +496,6 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
|||
mMaterials.Push(this);
|
||||
tx->gl_info.Material[expanded] = this;
|
||||
if (tx->bHasCanvas) tx->gl_info.mIsTransparent = 0;
|
||||
tex = tx;
|
||||
mExpanded = expanded;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue