aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2018-02-06 23:32:48 -0800
committerLukas Rusak <lorusak@gmail.com>2018-02-08 14:14:58 -0800
commit64ac6c78e6cbf2aba3dc1db02f259f747da13537 (patch)
tree49fba5a4c8e90a8f0cb4a132666ee232aa140f42
parent5199cf6ededabca6cca44c0ea8d73b0d6babe651 (diff)
RPRendererOpenGL: update to work with RPRendererOpenGLES changes
-rw-r--r--xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.cpp177
-rw-r--r--xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.h15
2 files changed, 0 insertions, 192 deletions
diff --git a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.cpp b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.cpp
index 97f5cfee31..1f3df880fa 100644
--- a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.cpp
+++ b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.cpp
@@ -44,67 +44,6 @@ CRenderBufferOpenGL::CRenderBufferOpenGL(AVPixelFormat format, AVPixelFormat tar
{
}
-void CRenderBufferOpenGL::CreateTexture()
-{
- glEnable(m_textureTarget);
-
- glGenTextures(1, &m_textureId);
-
- glBindTexture(m_textureTarget, m_textureId);
-
- glTexImage2D(m_textureTarget, 0, GL_RGBA, m_width, m_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
-
- glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- glDisable(m_textureTarget);
-}
-
-bool CRenderBufferOpenGL::UploadTexture()
-{
- if (m_textureBuffer.empty())
- {
- CLog::Log(LOGERROR, "Renderer: Unknown target texture size");
- return false;
- }
-
- if (m_targetFormat == AV_PIX_FMT_NONE)
- {
- CLog::Log(LOGERROR, "Renderer: Invalid target pixel format");
- return false;
- }
-
- if (!CreateScalingContext())
- return false;
-
- if (!glIsTexture(m_textureId))
- CreateTexture();
-
- ScalePixels(m_data.data(), m_data.size(), m_textureBuffer.data(), m_textureBuffer.size());
-
- glEnable(m_textureTarget);
-
- const unsigned int bpp = 1;
- glPixelStorei(GL_UNPACK_ALIGNMENT, bpp);
-
- const unsigned datatype = GL_UNSIGNED_BYTE;
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, m_width);
-
- glBindTexture(m_textureTarget, m_textureId);
- glTexSubImage2D(m_textureTarget, 0, 0, 0, m_width, m_height, GL_BGRA, datatype, m_textureBuffer.data());
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-
- glBindTexture(m_textureTarget, 0);
-
- glDisable(m_textureTarget);
-
- return true;
-}
-
// --- CRenderBufferPoolOpenGL -------------------------------------------------
IRenderBuffer *CRenderBufferPoolOpenGL::CreateRenderBuffer(void *header /* = nullptr */)
@@ -120,119 +59,3 @@ CRPRendererOpenGL::CRPRendererOpenGL(const CRenderSettings &renderSettings, CRen
// Initialize CRPRendererOpenGLES
m_clearColour = m_context.UseLimitedColor() ? (16.0f / 0xff) : 0.0f;
}
-
-void CRPRendererOpenGL::RenderInternal(bool clear, uint8_t alpha)
-{
- if (clear)
- {
- if (alpha == 255)
- DrawBlackBars();
- else
- ClearBackBuffer();
- }
-
- if (alpha < 255)
- {
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4f(1.0f, 1.0f, 1.0f, alpha / 250.f);
- }
- else
- {
- glDisable(GL_BLEND);
- glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- }
-
- Render();
-
- glEnable(GL_BLEND);
- glFlush();
-}
-
-void CRPRendererOpenGL::Render()
-{
- if (m_renderBuffer == nullptr)
- return;
-
- CRenderBufferOpenGL *renderBuffer = static_cast<CRenderBufferOpenGL*>(m_renderBuffer);
-
- glEnable(m_textureTarget);
-
- glActiveTextureARB(GL_TEXTURE0);
-
- glBindTexture(m_textureTarget, renderBuffer->TextureID());
-
- // Try some clamping or wrapping
- glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- GLint filter = (m_renderSettings.VideoSettings().GetScalingMethod() == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR);
- glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter);
- glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter);
-
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- glBegin(GL_QUADS);
-
- CRect rect = m_sourceRect;
-
- rect.x1 /= m_sourceWidth;
- rect.x2 /= m_sourceWidth;
- rect.y1 /= m_sourceHeight;
- rect.y2 /= m_sourceHeight;
-
- glTexCoord2f(rect.x1, rect.y1); glVertex2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y);
- glTexCoord2f(rect.x2, rect.y1); glVertex2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y);
- glTexCoord2f(rect.x2, rect.y2); glVertex2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y);
- glTexCoord2f(rect.x1, rect.y2); glVertex2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y);
-
- glEnd();
-
- glBindTexture(m_textureTarget, 0);
- glDisable(m_textureTarget);
-}
-
-void CRPRendererOpenGL::DrawBlackBars()
-{
- glColor4f(m_clearColour, m_clearColour, m_clearColour, 1.0f);
- glDisable(GL_BLEND);
- glBegin(GL_QUADS);
-
- //top quad
- if (m_rotatedDestCoords[0].y > 0.0)
- {
- glVertex4f(0.0, 0.0, 0.0, 1.0);
- glVertex4f(m_context.GetScreenWidth(), 0.0, 0.0, 1.0);
- glVertex4f(m_context.GetScreenWidth(), m_rotatedDestCoords[0].y, 0.0, 1.0);
- glVertex4f(0.0, m_rotatedDestCoords[0].y, 0.0, 1.0);
- }
-
- //bottom quad
- if (m_rotatedDestCoords[2].y < m_context.GetScreenHeight())
- {
- glVertex4f(0.0, m_rotatedDestCoords[2].y, 0.0, 1.0);
- glVertex4f(m_context.GetScreenWidth(), m_rotatedDestCoords[2].y, 0.0, 1.0);
- glVertex4f(m_context.GetScreenWidth(), m_context.GetScreenHeight(), 0.0, 1.0);
- glVertex4f(0.0, m_context.GetScreenHeight(), 0.0, 1.0);
- }
-
- //left quad
- if (m_rotatedDestCoords[0].x > 0.0)
- {
- glVertex4f(0.0, m_rotatedDestCoords[0].y, 0.0, 1.0);
- glVertex4f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y, 0.0, 1.0);
- glVertex4f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[2].y, 0.0, 1.0);
- glVertex4f(0.0, m_rotatedDestCoords[2].y, 0.0, 1.0);
- }
-
- //right quad
- if (m_rotatedDestCoords[2].x < m_context.GetScreenWidth())
- {
- glVertex4f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[0].y, 0.0, 1.0);
- glVertex4f(m_context.GetScreenWidth(), m_rotatedDestCoords[0].y, 0.0, 1.0);
- glVertex4f(m_context.GetScreenWidth(), m_rotatedDestCoords[2].y, 0.0, 1.0);
- glVertex4f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y, 0.0, 1.0);
- }
-
- glEnd();
-}
diff --git a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.h b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.h
index 03cb6c6f8b..053ada95ac 100644
--- a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.h
+++ b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGL.h
@@ -45,12 +45,6 @@ namespace RETRO
public:
CRenderBufferOpenGL(AVPixelFormat format, AVPixelFormat targetFormat, unsigned int width, unsigned int height);
~CRenderBufferOpenGL() override = default;
-
- // implementation of IRenderBuffer via CRenderBufferOpenGLES
- bool UploadTexture() override;
-
- private:
- void CreateTexture();
};
class CRenderBufferPoolOpenGL : public CRenderBufferPoolOpenGLES
@@ -68,15 +62,6 @@ namespace RETRO
public:
CRPRendererOpenGL(const CRenderSettings &renderSettings, CRenderContext &context, std::shared_ptr<IRenderBufferPool> bufferPool);
~CRPRendererOpenGL() override = default;
-
- protected:
- // implementation of CRPBaseRenderer via CRPRendererOpenGLES
- void RenderInternal(bool clear, uint8_t alpha) override;
-
- private:
- void Render();
-
- void DrawBlackBars();
};
}
}