mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-27 22:22:08 +00:00
- fixed: The textured automap was not using correct light levels.
In order for the externally passed vertex attribute to work the buffer's color attrib array needs to be disabled for these.
This commit is contained in:
parent
675822004d
commit
e5f88a9883
3 changed files with 41 additions and 0 deletions
|
@ -96,6 +96,33 @@ void FSimpleVertexBuffer::BindVBO()
|
|||
}
|
||||
}
|
||||
|
||||
void FSimpleVertexBuffer::EnableColorArray(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
if (gl.glslversion > 0)
|
||||
{
|
||||
glEnableVertexAttribArray(VATTR_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gl.glslversion > 0)
|
||||
{
|
||||
glDisableVertexAttribArray(VATTR_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FSimpleVertexBuffer::set(FSimpleVertex *verts, int count)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
}
|
||||
void BindVBO();
|
||||
void set(FSimpleVertex *verts, int count);
|
||||
void EnableColorArray(bool on);
|
||||
};
|
||||
|
||||
class FFlatVertexBuffer : public FVertexBuffer
|
||||
|
|
|
@ -384,6 +384,8 @@ void F2DDrawer::AddPixel(int x1, int y1, int palcolor, uint32 color)
|
|||
|
||||
void F2DDrawer::Flush()
|
||||
{
|
||||
F2DDrawer::EDrawType lasttype = DrawTypeTexture;
|
||||
|
||||
if (mData.Size() == 0) return;
|
||||
SBYTE savedlightmode = glset.lightmode;
|
||||
// lightmode is only relevant for automap subsectors,
|
||||
|
@ -394,6 +396,17 @@ void F2DDrawer::Flush()
|
|||
for (unsigned i = 0; i < mData.Size();)
|
||||
{
|
||||
DataGeneric *dg = (DataGeneric *)&mData[i];
|
||||
// DrawTypePoly may not use the color part of the vertex buffer because it needs to use gl_SetColor to produce proper output.
|
||||
if (lasttype == DrawTypePoly && dg->mType != DrawTypePoly)
|
||||
{
|
||||
EnableColorArray(true);
|
||||
}
|
||||
else if (lasttype != DrawTypePoly && dg->mType == DrawTypePoly)
|
||||
{
|
||||
EnableColorArray(false);
|
||||
}
|
||||
lasttype = dg->mType;
|
||||
|
||||
switch (dg->mType)
|
||||
{
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue