summaryrefslogtreecommitdiff
path: root/effects_gl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'effects_gl.cpp')
-rw-r--r--effects_gl.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/effects_gl.cpp b/effects_gl.cpp
index 2b8eac1..c3ff444 100644
--- a/effects_gl.cpp
+++ b/effects_gl.cpp
@@ -21,7 +21,7 @@ void Effect_GL_Start(gl_effect_layer *Test, int Width, int Height, int BytesPerP
}
void Effect_GL_DrawColor(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress,
- uint16 ShaderProgram, v4 Color, blend_mode BlendMode)
+ uint16 ShaderProgram, v4 Color)
{
gl_effect_layer Test = {};
@@ -72,3 +72,32 @@ void Effect_GL_GaussianBlur(int Width, int Height, int BytesPerPixel, void *Effe
glBindFramebuffer(GL_FRAMEBUFFER, 0);
GL_DeleteHWBuffer(&Test);
}
+
+void Effect_GL_Levels(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress,
+ uint16 ShaderProgram, real32 Min, real32 Mid, real32 Max, v4 ColMin, v4 ColMid, v4 ColMax)
+{
+ gl_effect_layer Test = {};
+
+ int ByteFlag = (BytesPerPixel == 4) ? GL_RGBA : GL_RGBA16;
+ int ByteFlag2 = (BytesPerPixel == 4) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
+ Effect_GL_Start(&Test, Width, Height, BytesPerPixel, EffectBitmapAddress, ShaderProgram);
+
+ int Uniform = glGetUniformLocation(ShaderProgram, "Start");
+ glUniform1f(Uniform, Min);
+ Uniform = glGetUniformLocation(ShaderProgram, "Mid");
+ glUniform1f(Uniform, Mid);
+ Uniform = glGetUniformLocation(ShaderProgram, "End");
+ glUniform1f(Uniform, Max);
+ Uniform = glGetUniformLocation(ShaderProgram, "StartCol");
+ glUniform4f(Uniform, ColMin.r, ColMin.g, ColMin.b, ColMin.a);
+ Uniform = glGetUniformLocation(ShaderProgram, "MidCol");
+ glUniform4f(Uniform, ColMid.r, ColMid.g, ColMid.b, ColMid.a);
+ Uniform = glGetUniformLocation(ShaderProgram, "EndCol");
+ glUniform4f(Uniform, ColMax.r, ColMax.g, ColMax.b, ColMax.a);
+
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
+ glReadPixels(0, 0, Width, Height, GL_RGBA, ByteFlag2, EffectBitmapAddress);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ GL_DeleteHWBuffer(&Test);
+}