Can you write OpenGL shader in a different file and later link it to the program? and if it's possible how? writing OpenGL shader in string makes my code messy.
Here is example code for shaders:
const char* vertexShaderSource = "#version 330 core\n" "layout (location = 0) in vec3 aPos;\n" "layout (location = 1) in vec3 aColor;\n" "\n" "out vec3 ourColor;\n" "uniform vec2 angleValues;\n" "\n" "void main()\n" "{\n" "gl_Position = vec4(aPos.x * angleValues.x - aPos.y * angleValues.y, aPos.y * angleValues.x + aPos.x * angleValues.y , aPos.z, 1.0);\n" "ourColor = aColor;\n" "}\n"; const char* fragmentShaderSource = "#version 330 core\n" "out vec4 FragColor;\n" "in vec3 ourColor;\n" "\n" "void main()\n" "{\n" "FragColor = vec4(ourColor, 1.0);\n" "}\n";
\n's.const char*.