summaryrefslogtreecommitdiff
path: root/gl_calls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gl_calls.cpp')
-rw-r--r--gl_calls.cpp67
1 files changed, 17 insertions, 50 deletions
diff --git a/gl_calls.cpp b/gl_calls.cpp
index 277db2e..1cb408a 100644
--- a/gl_calls.cpp
+++ b/gl_calls.cpp
@@ -29,56 +29,6 @@ const char *DefaultFragmentShaderSource = "#version 330 core\n"
" FragColor = vec4(vec3(1.0f), Col.a);\n"
"}\n"
"}\0";
-const char *FragmentShaderEffectSource[] = {"",
-"#version 330 core\n"
-"out vec4 FragColor;\n"
-"in vec2 TexCoord;\n"
-"uniform float Start;\n"
-"uniform float Mid;\n"
-"uniform float End;\n"
-"uniform vec4 StartCol;\n"
-"uniform vec4 MidCol;\n"
-"uniform vec4 EndCol;\n"
-"uniform sampler2D ourTexture;\n"
-"void main()\n"
-"{\n"
-"vec4 OutCol = texture(ourTexture, TexCoord);\n"
-// individual channels
-"vec4 ColorI = pow(OutCol, MidCol);\n"
-"vec4 ValI = 1.0f / (EndCol - StartCol) * (ColorI - StartCol);\n"
-// global channel (doesn't affect alpha)
-"vec4 ColorG = pow(ValI, vec4(Mid));\n"
-"vec4 ValG = 1.0f / (End - Start) * (ColorG - Start);\n"
-"ValG = vec4(ValG.rgb, ValI.a);\n"
-"FragColor = clamp(ValG, 0.0f, 1.0f);\n"
-"}\0",
-"#version 330 core\n"
-"uniform float Radius;\n"
-"uniform vec2 Direction;\n"
-"uniform sampler2D ourTexture;\n"
-"out vec4 FragColor;\n"
-"in vec2 TexCoord;\n"
-"\n"
-"vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {\n"
-" vec4 color = vec4(0.0f);\n"
-" float Omega = Radius / 3;\n"
-" float Divisor = 2*Omega*Omega;\n"
-" float A2 = 1.0f / (Omega * sqrt(2*3.141592));\n"
-" for (float Span = -round(Radius); Span < round(Radius); Span++) {\n"
-" float Dividend = -Span * Span;\n"
-" float Multiplier = A2 * exp(Dividend/Divisor);\n"
-" vec2 Dir = Span*direction;\n"
-" color += texture2D(image, uv + (Dir / resolution)) * Multiplier;\n"
-" }\n"
-" return color;\n"
-"}\n"
-"void main(void) {\n"
-" gl_FragColor = blur(ourTexture, TexCoord, vec2(1280, 720), Direction);\n"
-"}\0"
-};
-
-
-// #include "effects_gl.cpp"
static void GL_InitDefaultShader() {
DefaultVertexShader = glCreateShader(GL_VERTEX_SHADER);
@@ -168,6 +118,23 @@ GL_GenAndBindTexture(GLuint *GLTexture, int Width, int Height, int BytesPerPixel
glTexImage2D(GL_TEXTURE_2D, 0, ByteFlag, Width, Height, 0, GL_RGBA, ByteFlag2, BufferAddress);
}
+static void
+GL_BindDefaultVertexArrays()
+{
+ glBindVertexArray(DefaultVerts.VertexArrayObject);
+ // Switch to main buffer
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, DefaultVerts.ElementBufferObject);
+ glBindBuffer(GL_ARRAY_BUFFER, DefaultVerts.VertexBufferObject);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(GL_DefaultVertices), GL_DefaultVertices, GL_STATIC_DRAW);
+ // position attribute
+ glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
+ glEnableVertexAttribArray(0);
+ // texture coordinate (note the last parameter's offset)
+ glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
+ glEnableVertexAttribArray(1);
+
+}
+
void
GL_InitHWBuffer(gl_effect_layer *Test)
{