- game starts, but no 2D visible yet.

This commit is contained in:
Christoph Oelckers 2018-03-28 22:04:28 +02:00
parent 70b6754299
commit b194f2c466
3 changed files with 20 additions and 13 deletions

View file

@ -542,20 +542,28 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
GLRenderer->ScreenToWindowX(cmd.mScissor[3] - cmd.mScissor[1]));
}
else glDisable(GL_SCISSOR_TEST);
gl_RenderState.SetObjectColor(cmd.mColor1);
gl_RenderState.SetObjectColor2(cmd.mColor2);
if (cmd.mFlags & F2DDrawer::DTF_IngameLighting)
// Legacy mode cannot replicate the more complex effects
if (gl.legacyMode)
{
gl_RenderState.SetFixedColormap(CM_INGAME2D);
}
else if (cmd.mFlags & F2DDrawer::DTF_SpecialColormap)
{
gl_RenderState.SetFixedColormap(CM_SPECIAL2D);
gl_RenderState.SetFixedColormap(CM_DEFAULT);
}
else
{
gl_RenderState.SetFixedColormap(CM_PLAIN2D);
gl_RenderState.SetObjectColor(cmd.mColor1);
gl_RenderState.SetObjectColor2(cmd.mColor2);
if (cmd.mFlags & F2DDrawer::DTF_IngameLighting)
{
gl_RenderState.SetFixedColormap(CM_INGAME2D);
}
else if (cmd.mFlags & F2DDrawer::DTF_SpecialColormap)
{
gl_RenderState.SetFixedColormap(CM_SPECIAL2D);
}
else
{
gl_RenderState.SetFixedColormap(CM_PLAIN2D);
}
}
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);

View file

@ -482,6 +482,5 @@ void OpenGLFrameBuffer::ScaleCoordsFromWindow(int16_t &x, int16_t &y)
void OpenGLFrameBuffer::Draw2D()
{
//if (gl.legacyMode) Draw2DLegacy();
if (GLRenderer != nullptr) GLRenderer->Draw2D(&m2DDrawer);
}

View file

@ -323,7 +323,7 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
ptr->Set(x, y + h, 0, u1, v2, vertexcolor); ptr++;
ptr->Set(x + w, y, 0, u2, v1, vertexcolor); ptr++;
ptr->Set(x + w, y + h, 0, u2, v2, vertexcolor); ptr++;
AddIndices(6, dg.mVertIndex, 0, 1, 2, 1, 3, 2);
AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2);
AddCommand(&dg);
}
@ -433,7 +433,7 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *
ptr->Set(left, bottom, 0, fU1, fV2, 0xffffffff); ptr++;
ptr->Set(right, top, 0, fU2, fV1, 0xffffffff); ptr++;
ptr->Set(right, bottom, 0, fU2, fV2, 0xffffffff); ptr++;
AddIndices(6, dg.mVertIndex, 0, 1, 2, 1, 3, 2);
AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2);
AddCommand(&dg);
}
@ -457,7 +457,7 @@ void F2DDrawer::AddColorOnlyQuad(int x1, int y1, int w, int h, PalEntry color)
ptr->Set(x1, y1 + h, 0, 0, 0, color); ptr++;
ptr->Set(x1 + w, y1 + h, 0, 0, 0, color); ptr++;
ptr->Set(x1 + w, y1, 0, 0, 0, color); ptr++;
AddIndices(6, dg.mVertIndex, 0, 1, 2, 1, 3, 2);
AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2);
AddCommand(&dg);
}