summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/shaders/shadowDynamicPointStencil.fs4
-rw-r--r--gfx/gl/shaders/shadowDynamicPointStencil.gs4
-rw-r--r--gfx/gl/shadowStenciller.cpp13
3 files changed, 11 insertions, 10 deletions
diff --git a/gfx/gl/shaders/shadowDynamicPointStencil.fs b/gfx/gl/shaders/shadowDynamicPointStencil.fs
index 57b8aa3..e612691 100644
--- a/gfx/gl/shaders/shadowDynamicPointStencil.fs
+++ b/gfx/gl/shaders/shadowDynamicPointStencil.fs
@@ -1,9 +1,9 @@
#version 330 core
#extension GL_ARB_shading_language_420pack : enable
-layout(binding = 0) uniform sampler2D stencilDepth;
+layout(binding = 0) uniform sampler2DArray stencilDepth;
flat in vec3 scale;
-in vec2 texCoord;
+in vec3 texCoord;
void
main()
diff --git a/gfx/gl/shaders/shadowDynamicPointStencil.gs b/gfx/gl/shaders/shadowDynamicPointStencil.gs
index 2873691..b91937d 100644
--- a/gfx/gl/shaders/shadowDynamicPointStencil.gs
+++ b/gfx/gl/shaders/shadowDynamicPointStencil.gs
@@ -11,7 +11,7 @@ uniform float size;
in ivec3 vworldPos[];
flat out vec3 scale;
-out vec2 texCoord;
+out vec3 texCoord;
layout(points) in;
layout(triangle_strip, max_vertices = 16) out;
@@ -25,7 +25,7 @@ main()
for (int c = 0; c < corners.length(); ++c) {
gl_Position = pos + vec4(scale.xy * corners[c], 0, 0);
gl_Position.z = max(gl_Position.z, -1);
- texCoord = (corners[c] * 0.5) + 0.5;
+ texCoord = vec3((corners[c] * 0.5) + 0.5, 0);
EmitVertex();
}
EndPrimitive();
diff --git a/gfx/gl/shadowStenciller.cpp b/gfx/gl/shadowStenciller.cpp
index 0c34da5..01248bd 100644
--- a/gfx/gl/shadowStenciller.cpp
+++ b/gfx/gl/shadowStenciller.cpp
@@ -25,15 +25,16 @@ glTexture
ShadowStenciller::createStencilTexture(GLsizei width, GLsizei height)
{
glTexture stencil;
- glBindTexture(GL_TEXTURE_2D, stencil);
+ glBindTexture(GL_TEXTURE_2D_ARRAY, stencil);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameter(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameter(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameter(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameter(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, nullptr);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT, width, height, 8, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE,
+ nullptr);
return stencil;
}