diff options
author | iurii plugatarov <[email protected]> | 2024-08-07 20:16:41 +0200 |
---|---|---|
committer | iurii plugatarov <[email protected]> | 2024-08-07 20:16:41 +0200 |
commit | 07d31cd578dbc13024b15b60a8ae4c5eb1b06609 (patch) | |
tree | d225ed17843d6f44c8b5aa382659137d45e1dfd4 /src | |
parent | 5ba3d169752a3f15289bf9bb03033b1786c50c29 (diff) | |
download | ogl-07d31cd578dbc13024b15b60a8ae4c5eb1b06609.tar.gz |
frag
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index 7b498c7..a333712 100644 --- a/src/main.c +++ b/src/main.c @@ -54,6 +54,28 @@ int main() { printf("ERROR::SHADER::VERTEX::COMPILATION_FAILED %s\n", info_log); } + const char *fragment_shader_src = + "#version 330 core\n" + "out vec4 FragColor;\n" + "void main()\n" + "{\n" + " FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n" + "}\0"; + + unsigned int fragment_shader; + fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(fragment_shader, 1, &fragment_shader_src, NULL); + glCompileShader(fragment_shader); + glGetShaderiv(fragment_shader, GL_COMPILE_STATUS, &success); + + if (!success) { + glGetShaderInfoLog(fragment_shader, 512, NULL, info_log); + printf("ERROR::SHADER::FRAGMENT::COMPILATION_FAILED %s\n", info_log); + } + + unsigned int shader_program; + shader_program = glCreateProgram(); + while (!glfwWindowShouldClose(window)) { glClearColor(0.1f, 0.1f, 0.25f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); |