summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/OpenGL.cpp3
-rw-r--r--src/render/Shader.hpp1
-rw-r--r--src/render/shaders/Border.hpp7
3 files changed, 7 insertions, 4 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 2d9f9314..c441bd1e 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -237,6 +237,7 @@ void CHyprOpenGLImpl::initShaders() {
m_RenderData.pCurrentMonData->m_shBORDER1.topLeft = glGetUniformLocation(prog, "topLeft");
m_RenderData.pCurrentMonData->m_shBORDER1.bottomRight = glGetUniformLocation(prog, "bottomRight");
m_RenderData.pCurrentMonData->m_shBORDER1.fullSize = glGetUniformLocation(prog, "fullSize");
+ m_RenderData.pCurrentMonData->m_shBORDER1.fullSizeUntransformed = glGetUniformLocation(prog, "fullSizeUntransformed");
m_RenderData.pCurrentMonData->m_shBORDER1.radius = glGetUniformLocation(prog, "radius");
m_RenderData.pCurrentMonData->m_shBORDER1.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
m_RenderData.pCurrentMonData->m_shBORDER1.gradient = glGetUniformLocation(prog, "gradient");
@@ -863,8 +864,8 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad,
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
glUniform2f(m_RenderData.pCurrentMonData->m_shBORDER1.topLeft, (float)TOPLEFT.x, (float)TOPLEFT.y);
- //glUniform2f(m_RenderData.pCurrentMonData->m_shBORDER1.bottomRight, (float)BOTTOMRIGHT.x, (float)BOTTOMRIGHT.y);
glUniform2f(m_RenderData.pCurrentMonData->m_shBORDER1.fullSize, (float)FULLSIZE.x, (float)FULLSIZE.y);
+ glUniform2f(m_RenderData.pCurrentMonData->m_shBORDER1.fullSizeUntransformed, (float)box->width, (float)box->height);
glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.radius, round);
glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.thick, scaledBorderSize);
glUniform1i(m_RenderData.pCurrentMonData->m_shBORDER1.primitiveMultisample, *PMULTISAMPLE);
diff --git a/src/render/Shader.hpp b/src/render/Shader.hpp
index db98b1f2..c9c63725 100644
--- a/src/render/Shader.hpp
+++ b/src/render/Shader.hpp
@@ -19,6 +19,7 @@ public:
GLint topLeft;
GLint bottomRight;
GLint fullSize;
+ GLint fullSizeUntransformed;
GLint radius;
GLint primitiveMultisample;
diff --git a/src/render/shaders/Border.hpp b/src/render/shaders/Border.hpp
index c2be9880..274ae362 100644
--- a/src/render/shaders/Border.hpp
+++ b/src/render/shaders/Border.hpp
@@ -10,6 +10,7 @@ varying vec2 v_texcoord;
uniform vec2 topLeft;
uniform vec2 fullSize;
+uniform vec2 fullSizeUntransformed;
uniform float radius;
uniform float thick;
uniform int primitiveMultisample;
@@ -51,7 +52,7 @@ vec4 getColorForCoord(vec2 normalizedCoord) {
void main() {
highp vec2 pixCoord = vec2(gl_FragCoord);
- vec2 originalPixCoord = fullSize * v_texcoord;
+ vec2 originalPixCoord = fullSizeUntransformed * v_texcoord;
vec4 pixColor = getColorForCoord(v_texcoord);
pixColor[3] *= alpha;
@@ -96,9 +97,9 @@ void main() {
if (!done) {
// distance to all straight bb borders
float distanceT = originalPixCoord[1];
- float distanceB = fullSize[1] - originalPixCoord[1];
+ float distanceB = fullSizeUntransformed[1] - originalPixCoord[1];
float distanceL = originalPixCoord[0];
- float distanceR = fullSize[0] - originalPixCoord[0];
+ float distanceR = fullSizeUntransformed[0] - originalPixCoord[0];
// get the smallest
float smallest = min(min(distanceT, distanceB), min(distanceL, distanceR));