mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 21:45:58 +01:00
Let openGL transpose the matrixes for us.
This commit is contained in:
parent
1263bd5dcb
commit
092dbda88a
1 changed files with 5 additions and 14 deletions
|
@ -325,14 +325,12 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, pixm
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
||||||
|
|
||||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glUseProgram(m_RenderData.pCurrentMonData->m_shQUAD.program);
|
glUseProgram(m_RenderData.pCurrentMonData->m_shQUAD.program);
|
||||||
|
|
||||||
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shQUAD.proj, 1, GL_TRUE, glMatrix);
|
||||||
glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
||||||
|
|
||||||
wlr_box transformedBox;
|
wlr_box transformedBox;
|
||||||
|
@ -416,8 +414,6 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
||||||
|
|
||||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
|
||||||
|
|
||||||
CShader* shader = nullptr;
|
CShader* shader = nullptr;
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
@ -444,7 +440,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
||||||
|
|
||||||
glUseProgram(shader->program);
|
glUseProgram(shader->program);
|
||||||
|
|
||||||
glUniformMatrix3fv(shader->proj, 1, GL_FALSE, glMatrix);
|
glUniformMatrix3fv(shader->proj, 1, GL_TRUE, glMatrix);
|
||||||
glUniform1i(shader->tex, 0);
|
glUniform1i(shader->tex, 0);
|
||||||
glUniform1f(shader->alpha, alpha / 255.f);
|
glUniform1f(shader->alpha, alpha / 255.f);
|
||||||
glUniform1i(shader->discardOpaque, (int)discardOpaque);
|
glUniform1i(shader->discardOpaque, (int)discardOpaque);
|
||||||
|
@ -534,7 +530,6 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
|
||||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
wlr_matrix_transpose(glMatrix, glMatrix);
|
||||||
|
|
||||||
// get the config settings
|
// get the config settings
|
||||||
|
@ -570,7 +565,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
||||||
glUseProgram(pShader->program);
|
glUseProgram(pShader->program);
|
||||||
|
|
||||||
// prep two shaders
|
// prep two shaders
|
||||||
glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix);
|
glUniformMatrix3fv(pShader->proj, 1, GL_TRUE, glMatrix);
|
||||||
glUniform1f(pShader->radius, *PBLURSIZE * (a / 255.f)); // this makes the blursize change with a
|
glUniform1f(pShader->radius, *PBLURSIZE * (a / 255.f)); // this makes the blursize change with a
|
||||||
if (pShader == &m_RenderData.pCurrentMonData->m_shBLUR1)
|
if (pShader == &m_RenderData.pCurrentMonData->m_shBLUR1)
|
||||||
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR1.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f));
|
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR1.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f));
|
||||||
|
@ -847,14 +842,12 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int round) {
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
||||||
|
|
||||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glUseProgram(m_RenderData.pCurrentMonData->m_shBORDER1.program);
|
glUseProgram(m_RenderData.pCurrentMonData->m_shBORDER1.program);
|
||||||
|
|
||||||
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBORDER1.proj, 1, GL_FALSE, glMatrix);
|
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBORDER1.proj, 1, GL_TRUE, glMatrix);
|
||||||
glUniform4f(m_RenderData.pCurrentMonData->m_shBORDER1.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
glUniform4f(m_RenderData.pCurrentMonData->m_shBORDER1.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
||||||
|
|
||||||
const auto TOPLEFT = Vector2D(round, round);
|
const auto TOPLEFT = Vector2D(round, round);
|
||||||
|
@ -1105,14 +1098,12 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
||||||
|
|
||||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glUseProgram(m_RenderData.pCurrentMonData->m_shSHADOW.program);
|
glUseProgram(m_RenderData.pCurrentMonData->m_shSHADOW.program);
|
||||||
|
|
||||||
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shSHADOW.proj, 1, GL_FALSE, glMatrix);
|
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shSHADOW.proj, 1, GL_TRUE, glMatrix);
|
||||||
glUniform4f(m_RenderData.pCurrentMonData->m_shSHADOW.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f * a);
|
glUniform4f(m_RenderData.pCurrentMonData->m_shSHADOW.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f * a);
|
||||||
|
|
||||||
const auto TOPLEFT = Vector2D(range + round, range + round);
|
const auto TOPLEFT = Vector2D(range + round, range + round);
|
||||||
|
|
Loading…
Reference in a new issue