mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- remove use of builtin and deprecated color vertex attribute.
This commit is contained in:
parent
5193f6cfef
commit
5a322742c3
5 changed files with 9 additions and 6 deletions
|
@ -136,7 +136,7 @@ bool FRenderState::ApplyShader()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glColor4fv(mColor.vec);
|
glVertexAttrib4fv(VATTR_COLOR, mColor.vec);
|
||||||
|
|
||||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||||
activeShader->muFogEnabled.Set(fogset);
|
activeShader->muFogEnabled.Set(fogset);
|
||||||
|
|
|
@ -82,10 +82,10 @@ FSkyVertexBuffer::FSkyVertexBuffer()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||||
glVertexPointer(3, GL_FLOAT, sizeof(FSkyVertex), &VSO->x);
|
glVertexPointer(3, GL_FLOAT, sizeof(FSkyVertex), &VSO->x);
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(FSkyVertex), &VSO->u);
|
glTexCoordPointer(2, GL_FLOAT, sizeof(FSkyVertex), &VSO->u);
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(FSkyVertex), &VSO->color);
|
glVertexAttribPointer(VATTR_COLOR, 4, GL_UNSIGNED_BYTE, true, sizeof(FSkyVertex), &VSO->color);
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableVertexAttribArray(VATTR_COLOR);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
fp_comb.Substitute("vec4 frag = ProcessTexel();", "vec4 frag = Process(vec4(1.0));");
|
fp_comb.Substitute("vec4 frag = ProcessTexel();", "vec4 frag = Process(vec4(1.0));");
|
||||||
}
|
}
|
||||||
fp_comb << pp_data.GetString().GetChars();
|
fp_comb << pp_data.GetString().GetChars();
|
||||||
|
fp_comb.Substitute("gl_TexCoord[0]", "vTexCoord"); // fix old custom shaders.
|
||||||
|
|
||||||
if (pp_data.GetString().IndexOf("ProcessLight") < 0)
|
if (pp_data.GetString().IndexOf("ProcessLight") < 0)
|
||||||
{
|
{
|
||||||
|
@ -156,6 +157,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
|
|
||||||
glAttachShader(hShader, hVertProg);
|
glAttachShader(hShader, hVertProg);
|
||||||
glAttachShader(hShader, hFragProg);
|
glAttachShader(hShader, hFragProg);
|
||||||
|
glBindAttribLocation(hShader, VATTR_COLOR, "aColor");
|
||||||
|
glBindAttribLocation(hShader, VATTR_VERTEX2, "aVertex2");
|
||||||
|
|
||||||
glLinkProgram(hShader);
|
glLinkProgram(hShader);
|
||||||
|
|
||||||
|
@ -213,8 +216,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
modelmatrix_index = glGetUniformLocation(hShader, "ModelMatrix");
|
modelmatrix_index = glGetUniformLocation(hShader, "ModelMatrix");
|
||||||
texturematrix_index = glGetUniformLocation(hShader, "TextureMatrix");
|
texturematrix_index = glGetUniformLocation(hShader, "TextureMatrix");
|
||||||
|
|
||||||
glBindAttribLocation(hShader, VATTR_VERTEX2, "aVertex2");
|
|
||||||
|
|
||||||
glUseProgram(hShader);
|
glUseProgram(hShader);
|
||||||
|
|
||||||
int texture_index = glGetUniformLocation(hShader, "texture2");
|
int texture_index = glGetUniformLocation(hShader, "texture2");
|
||||||
|
|
|
@ -9,6 +9,7 @@ extern bool gl_shaderactive;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
VATTR_COLOR = 14,
|
||||||
VATTR_VERTEX2 = 15
|
VATTR_VERTEX2 = 15
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
in vec4 aColor;
|
||||||
#ifndef SIMPLE // we do not need these for simple shaders
|
#ifndef SIMPLE // we do not need these for simple shaders
|
||||||
in vec4 aVertex2;
|
in vec4 aVertex2;
|
||||||
out vec4 pixelpos;
|
out vec4 pixelpos;
|
||||||
|
@ -43,7 +44,7 @@ void main()
|
||||||
|
|
||||||
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
||||||
|
|
||||||
vColor = gl_Color;
|
vColor = aColor;
|
||||||
|
|
||||||
#ifndef SIMPLE
|
#ifndef SIMPLE
|
||||||
pixelpos.xyz = worldcoord.xyz;
|
pixelpos.xyz = worldcoord.xyz;
|
||||||
|
|
Loading…
Reference in a new issue