get the whole OpenGL shit going

This commit is contained in:
Arisotura
2020-05-25 14:59:26 +02:00
parent 4e34359a80
commit 10f9eda58a
3 changed files with 145 additions and 27 deletions

View File

@ -21,12 +21,8 @@
const char* kScreenVS = R"(#version 140
layout(std140) uniform uConfig
{
vec2 uScreenSize;
uint u3DScale;
uint uFilterMode;
};
uniform vec2 uScreenSize;
uniform mat2x3 uTransform;
in vec2 vPosition;
in vec2 vTexcoord;
@ -36,7 +32,10 @@ smooth out vec2 fTexcoord;
void main()
{
vec4 fpos;
fpos.xy = ((vPosition * 2.0) / uScreenSize) - 1.0;
fpos.xy = vec3(vPosition, 1.0) * uTransform;
fpos.xy = ((fpos.xy * 2.0) / uScreenSize) - 1.0;
fpos.y *= -1;
fpos.z = 0.0;
fpos.w = 1.0;
@ -48,14 +47,7 @@ void main()
const char* kScreenFS = R"(#version 140
layout(std140) uniform uConfig
{
vec2 uScreenSize;
uint u3DScale;
uint uFilterMode;
};
uniform usampler2D ScreenTex;
uniform sampler2D ScreenTex;
smooth in vec2 fTexcoord;
@ -63,11 +55,9 @@ out vec4 oColor;
void main()
{
ivec4 pixel = ivec4(texelFetch(ScreenTex, ivec2(fTexcoord), 0));
vec4 pixel = texture2D(ScreenTex, fTexcoord);
// TODO: filters
oColor = vec4(vec3(pixel.bgr) / 255.0, 1.0);
oColor = vec4(pixel.bgr, 1.0);
}
)";