summaryrefslogtreecommitdiff
path: root/effects_gl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'effects_gl.cpp')
-rw-r--r--effects_gl.cpp101
1 files changed, 0 insertions, 101 deletions
diff --git a/effects_gl.cpp b/effects_gl.cpp
deleted file mode 100644
index 2c1435b..0000000
--- a/effects_gl.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-static uint16 Effect_GL_InitShader(int EffectIndex);
-static uint16 GL_EffectShaderProgram[512];
-static void GL_BindDefaultVertexArrays();
-static void GL_InitTexture(gl_effect_layer *Test);
-
-void Effect_GL_Levels(source *Source, layer_bitmap_info *BitmapInfo, memory *Memory, property_channel Property[])
-{
- real32 All_Start = Property[0].CurrentValue.f;
- real32 All_Mid = Property[1].CurrentValue.f;
- real32 All_End = Property[2].CurrentValue.f;
- v4 Start = Property[3].CurrentValue.col;
- v4 Mid = Property[4].CurrentValue.col;
- v4 End = Property[5].CurrentValue.col;
-
- if (!BitmapInfo->Test.Initialized) {
- GL_InitTexture(&BitmapInfo->Test);
- }
-
- gl_effect_layer Test = BitmapInfo->Test;
- uint8 *Data = (uint8 *)BitmapInfo->BitmapBuffer;
- uint16 Width = Source->Info.Width;
- uint16 Height = Source->Info.Height;
-
- glBindTexture(GL_TEXTURE_2D, Test.Texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, Data);
-
- glBindFramebuffer(GL_FRAMEBUFFER, Test.FramebufferObject);
- glBindRenderbuffer(GL_RENDERBUFFER, Test.Color_Renderbuffer);
-
- uint16 ShaderProgram = Effect_GL_InitShader(1);
-
- GL_BindDefaultVertexArrays();
-
- int vertexColorLocation = glGetUniformLocation(ShaderProgram, "Start");
- glUniform1f(vertexColorLocation, All_Start);
- vertexColorLocation = glGetUniformLocation(ShaderProgram, "Mid");
- glUniform1f(vertexColorLocation, All_Mid);
- vertexColorLocation = glGetUniformLocation(ShaderProgram, "End");
- glUniform1f(vertexColorLocation, All_End);
- vertexColorLocation = glGetUniformLocation(ShaderProgram, "StartCol");
- glUniform4f(vertexColorLocation, Start.r, Start.g, Start.b, Start.a);
- vertexColorLocation = glGetUniformLocation(ShaderProgram, "MidCol");
- glUniform4f(vertexColorLocation, Mid.r, Mid.g, Mid.b, Mid.a);
- vertexColorLocation = glGetUniformLocation(ShaderProgram, "EndCol");
- glUniform4f(vertexColorLocation, End.r, End.g, End.b, End.a);
-
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
-
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, &Data[0]);
-
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
-
-}
-
-void Effect_GL_GaussianBlur(source *Source, layer_bitmap_info *BitmapInfo, memory *Memory, property_channel Property[])
-{
- real32 Radius = Property[0].CurrentValue.f;
-
- if (!BitmapInfo->Test.Initialized) {
- GL_InitTexture(&BitmapInfo->Test);
- }
-
- gl_effect_layer Test = BitmapInfo->Test;
- uint8 *Data = (uint8 *)BitmapInfo->BitmapBuffer;
- uint16 Width = Source->Info.Width;
- uint16 Height = Source->Info.Height;
-
- glBindTexture(GL_TEXTURE_2D, Test.Texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, Data);
-
- glBindFramebuffer(GL_FRAMEBUFFER, Test.FramebufferObject);
- glBindRenderbuffer(GL_RENDERBUFFER, Test.Color_Renderbuffer);
-
- uint16 ShaderProgram = Effect_GL_InitShader(2);
-
- GL_BindDefaultVertexArrays();
-
- int vertexColorLocation = glGetUniformLocation(ShaderProgram, "Radius");
- glUniform1f(vertexColorLocation, Radius + 1.60f);
- vertexColorLocation = glGetUniformLocation(ShaderProgram, "Direction");
- glUniform2f(vertexColorLocation, 1.0f, 0.0f);
-
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, &Data[0]);
-
- // This blur works in two passes.
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, Data);
-
- vertexColorLocation = glGetUniformLocation(ShaderProgram, "Direction");
- glUniform2f(vertexColorLocation, 0.0f, 1.0f);
-
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, &Data[0]);
-
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
-
-}