mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-01 08:01:08 +00:00
Fixed black screen issue in OS X native backend
There was inconsistency with global render state
This commit is contained in:
parent
6d95c9d544
commit
138c6ea25e
1 changed files with 23 additions and 27 deletions
|
@ -58,6 +58,8 @@
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#include "gl/system/gl_system.h"
|
||||||
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "gl/renderer/gl_renderer.h"
|
#include "gl/renderer/gl_renderer.h"
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
#include "gl/system/gl_interface.h"
|
#include "gl/system/gl_interface.h"
|
||||||
|
@ -1278,36 +1280,30 @@ void BoundTextureSetFilter(const GLenum target, const GLint filter)
|
||||||
|
|
||||||
void BoundTextureDraw2D(const GLsizei width, const GLsizei height)
|
void BoundTextureDraw2D(const GLsizei width, const GLsizei height)
|
||||||
{
|
{
|
||||||
const bool flipX = width < 0;
|
gl_RenderState.SetTextureMode(TM_OPAQUE);
|
||||||
const bool flipY = height < 0;
|
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||||
|
gl_RenderState.ResetColor();
|
||||||
|
gl_RenderState.Apply();
|
||||||
|
|
||||||
const float u0 = flipX ? 1.0f : 0.0f;
|
static const float x = 0.f;
|
||||||
const float v0 = flipY ? 1.0f : 0.0f;
|
static const float y = 0.f;
|
||||||
const float u1 = flipX ? 0.0f : 1.0f;
|
const float w = float(width);
|
||||||
const float v1 = flipY ? 0.0f : 1.0f;
|
const float h = float(height);
|
||||||
|
|
||||||
const float x1 = 0.0f;
|
static const float u1 = 0.f;
|
||||||
const float y1 = 0.0f;
|
static const float v1 = 1.f;
|
||||||
const float x2 = abs(width );
|
static const float u2 = 1.f;
|
||||||
const float y2 = abs(height);
|
static const float v2 = 0.f;
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
FFlatVertexBuffer* const vbo = GLRenderer->mVBO;
|
||||||
glDisable(GL_ALPHA_TEST);
|
FFlatVertex* ptr = vbo->GetBuffer();
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
ptr->Set(x, y, 0, u1, v1); ++ptr;
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
ptr->Set(x, y + h, 0, u1, v2); ++ptr;
|
||||||
glTexCoord2f(u0, v1);
|
ptr->Set(x + w, y, 0, u2, v1); ++ptr;
|
||||||
glVertex2f(x1, y1);
|
ptr->Set(x + w, y + h, 0, u2, v2); ++ptr;
|
||||||
glTexCoord2f(u1, v1);
|
|
||||||
glVertex2f(x2, y1);
|
|
||||||
glTexCoord2f(u1, v0);
|
|
||||||
glVertex2f(x2, y2);
|
|
||||||
glTexCoord2f(u0, v0);
|
|
||||||
glVertex2f(x1, y2);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
vbo->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||||
glEnable(GL_BLEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BoundTextureSaveAsPNG(const GLenum target, const char* const path)
|
bool BoundTextureSaveAsPNG(const GLenum target, const char* const path)
|
||||||
|
@ -1504,8 +1500,8 @@ void CocoaOpenGLFrameBuffer::DrawRenderTarget()
|
||||||
{
|
{
|
||||||
m_renderTarget.Unbind();
|
m_renderTarget.Unbind();
|
||||||
|
|
||||||
m_renderTarget.GetColorTexture().Bind(0, 0, 0);
|
m_renderTarget.GetColorTexture().Bind(0, 0, false);
|
||||||
m_gammaTexture.Bind(1, 0, 0);
|
m_gammaTexture.Bind(1, 0, false);
|
||||||
|
|
||||||
if (rbOpts.dirty)
|
if (rbOpts.dirty)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue