summaryrefslogtreecommitdiff
path: root/effects_gl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'effects_gl.cpp')
-rw-r--r--effects_gl.cpp103
1 files changed, 0 insertions, 103 deletions
diff --git a/effects_gl.cpp b/effects_gl.cpp
deleted file mode 100644
index c3ff444..0000000
--- a/effects_gl.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-void GL_UpdateTexture(gl_effect_layer *Test, void *Data, uint16 Width, uint16 Height, uint16 BytesPerPixel, bool32 Multisample);
-static uint16 Effect_GL_InitShader(const char *Effect);
-static void GL_BindDefaultVertexArrays();
-
-void Effect_GL_Start(gl_effect_layer *Test, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, uint16 ShaderProgram)
-{
- GL_UpdateTexture(Test, EffectBitmapAddress, Width, Height, BytesPerPixel, 0);
-
- GL_BindDefaultVertexArrays();
-
- glUseProgram(ShaderProgram);
-
- glBindFramebuffer(GL_FRAMEBUFFER, Test->FramebufferObject);
- glBindRenderbuffer(GL_RENDERBUFFER, Test->Color_Renderbuffer);
-
- glBindTexture(GL_TEXTURE_2D, Test->Texture);
- int ByteFlag = (BytesPerPixel == 4) ? GL_RGBA : GL_RGBA16;
- int ByteFlag2 = (BytesPerPixel == 4) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
- glTexImage2D(GL_TEXTURE_2D, 0, ByteFlag, Width, Height, 0, GL_RGBA,
- ByteFlag2, EffectBitmapAddress);
-}
-
-void Effect_GL_DrawColor(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress,
- uint16 ShaderProgram, v4 Color)
-{
- 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, "Color");
- glUniform4f(Uniform, Color.r, Color.g, Color.b, Color.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);
-}
-
-void Effect_GL_GaussianBlur(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress,
- uint16 ShaderProgram, real32 Radius)
-{
- 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);
-
- // horizontal pass
- int Uniform = glGetUniformLocation(ShaderProgram, "Radius");
- glUniform1f(Uniform, Radius + 1.60f);
- Uniform = glGetUniformLocation(ShaderProgram, "Direction");
- glUniform2f(Uniform, 1.0f, 0.0f);
-
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
- glReadPixels(0, 0, Width, Height, GL_RGBA, ByteFlag2, EffectBitmapAddress);
- //
-
- // vertical pass
- glTexImage2D(GL_TEXTURE_2D, 0, ByteFlag, Width, Height, 0, GL_RGBA,
- ByteFlag2, EffectBitmapAddress);
-
- Radius = glGetUniformLocation(ShaderProgram, "Direction");
- glUniform2f(Uniform, 0.0f, 1.0f);
-
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
- glReadPixels(0, 0, Width, Height, GL_RGBA, ByteFlag2, EffectBitmapAddress);
- //
-
- 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);
-}