#52 fixes macOS OpenGL core profile

This commit is contained in:
FunkyFr3sh 2020-10-23 17:56:24 +02:00
parent 7229a2a34e
commit 05d665dea9
3 changed files with 60 additions and 4 deletions

View file

@ -1,7 +1,7 @@
#ifndef OPENGLSHADER_H
#define OPENGLSHADER_H
// old
// OpenGL 2.0
const char PASSTHROUGH_VERT_SHADER_110[] =
"#version 110\n"
@ -37,7 +37,7 @@ const char PASSTHROUGH_FRAG_SHADER_110[] =
" gl_FragColor = texel; \n"
"}\n";
// new
// OpenGL 3.0
const char PASSTHROUGH_VERT_SHADER[] =
"#version 130\n"
@ -82,4 +82,49 @@ const char PASSTHROUGH_FRAG_SHADER[] =
" FragColor = texel;\n"
"}\n";
// OpenGL 3.2 (Core Profile)
const char PASSTHROUGH_VERT_SHADER_CORE[] =
"#version 150\n"
"in vec4 VertexCoord;\n"
"in vec4 COLOR;\n"
"in vec4 TexCoord;\n"
"out vec4 COL0;\n"
"out vec4 TEX0;\n"
"uniform mat4 MVPMatrix;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = MVPMatrix * VertexCoord;\n"
" COL0 = COLOR;\n"
" TEX0.xy = TexCoord.xy;\n"
"}\n";
const char PALETTE_FRAG_SHADER_CORE[] =
"#version 150\n"
"out vec4 FragColor;\n"
"uniform sampler2D SurfaceTex;\n"
"uniform sampler2D PaletteTex;\n"
"in vec4 TEX0;\n"
"\n"
"void main()\n"
"{\n"
" vec4 pIndex = texture(SurfaceTex, TEX0.xy);\n"
" FragColor = texture(PaletteTex, vec2(pIndex.r * (255.0/256.0) + (0.5/256.0), 0));\n"
"}\n";
const char PASSTHROUGH_FRAG_SHADER_CORE[] =
"#version 150\n"
"out vec4 FragColor;\n"
"uniform sampler2D SurfaceTex;\n"
"in vec4 TEX0;\n"
"\n"
"void main()\n"
"{\n"
" vec4 texel = texture(SurfaceTex, TEX0.xy);\n"
" FragColor = texel;\n"
"}\n";
#endif