1
0
Fork 0

Convert existing shaders to C++11 raw strings

Shaders were previously saved as standard C++ string concatenations.
This commit converts them to the C++11 raw string syntax using a raw
string delimiter of `GLSL`.

This format is preferable as it will allow the shaders to be viewed and
edited directly, without having to make considerations for any escape
characters within the code.
This commit is contained in:
Tyrell Sassen 2020-04-24 22:08:26 -07:00 committed by Patryk Obara
parent 9c90722ee7
commit de43073145
2 changed files with 570 additions and 559 deletions

File diff suppressed because it is too large Load diff

View file

@ -373,22 +373,23 @@ Read AUTHORS file for more details.
)";
#if C_OPENGL
static char const shader_src_default[] =
"varying vec2 v_texCoord;\n"
"#if defined(VERTEX)\n"
"uniform vec2 rubyTextureSize;\n"
"uniform vec2 rubyInputSize;\n"
"attribute vec4 a_position;\n"
"void main() {\n"
" gl_Position = a_position;\n"
" v_texCoord = vec2(a_position.x+1.0,1.0-a_position.y)/2.0*rubyInputSize/rubyTextureSize;\n"
"}\n"
"#elif defined(FRAGMENT)\n"
"uniform sampler2D rubyTexture;\n\n"
"void main() {\n"
" gl_FragColor = texture2D(rubyTexture, v_texCoord);\n"
"}\n"
"#endif\n";
static char const shader_src_default[] = R"GLSL(
varying vec2 v_texCoord;
#if defined(VERTEX)
uniform vec2 rubyTextureSize;
uniform vec2 rubyInputSize;
attribute vec4 a_position;
void main() {
gl_Position = a_position;
v_texCoord = vec2(a_position.x+1.0,1.0-a_position.y)/2.0*rubyInputSize/rubyTextureSize;
}
#elif defined(FRAGMENT)
uniform sampler2D rubyTexture;
void main() {
gl_FragColor = texture2D(rubyTexture, v_texCoord);
}
#endif
)GLSL";
#ifdef DB_OPENGL_ERROR
void OPENGL_ERROR(const char* message) {