From 07d31cd578dbc13024b15b60a8ae4c5eb1b06609 Mon Sep 17 00:00:00 2001 From: iurii plugatarov Date: Wed, 7 Aug 2024 21:16:41 +0300 Subject: frag --- src/main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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); -- cgit 1.4.1-2-gfad0