mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Fix stereo-3D 2D quad color problem.
This commit is contained in:
parent
b670d5f372
commit
e83092a7eb
1 changed files with 7 additions and 5 deletions
|
@ -102,9 +102,9 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
||||||
state.EnableMultisampling(false);
|
state.EnableMultisampling(false);
|
||||||
state.EnableLineSmooth(gl_aalines);
|
state.EnableLineSmooth(gl_aalines);
|
||||||
|
|
||||||
auto &vertices = drawer->mVertices;
|
auto const &verticesBgra = drawer->mVertices;
|
||||||
auto &indices = drawer->mIndices;
|
auto const &indices = drawer->mIndices;
|
||||||
auto &commands = drawer->mData;
|
auto const &commands = drawer->mData;
|
||||||
|
|
||||||
if (commands.Size() == 0)
|
if (commands.Size() == 0)
|
||||||
{
|
{
|
||||||
|
@ -112,13 +112,15 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &v : vertices)
|
// copy vertices before modifying them, to avoid stereo 3d eye mismatch
|
||||||
|
auto verticesRgba = verticesBgra;
|
||||||
|
for (auto &v : verticesRgba)
|
||||||
{
|
{
|
||||||
// Change from BGRA to RGBA
|
// Change from BGRA to RGBA
|
||||||
std::swap(v.color0.r, v.color0.b);
|
std::swap(v.color0.r, v.color0.b);
|
||||||
}
|
}
|
||||||
F2DVertexBuffer vb;
|
F2DVertexBuffer vb;
|
||||||
vb.UploadData(&vertices[0], vertices.Size(), &indices[0], indices.Size());
|
vb.UploadData(&verticesRgba[0], verticesRgba.Size(), &indices[0], indices.Size());
|
||||||
state.SetVertexBuffer(&vb);
|
state.SetVertexBuffer(&vb);
|
||||||
state.EnableFog(false);
|
state.EnableFog(false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue