| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | "\n" |
| | | "void main()\n" |
| | | "{\n" |
| | | " gl_FragColor = texture2D(tex0, v_texCoord);\n" |
| | | " gl_FragColor.a = 1.0;\n" |
| | | " gl_FragColor *= v_color;\n" |
| | | "}" |
| | | }, |
| | | |
| | | /* SHADER_RGBA */ |
| | | { |
| | | /* vertex shader */ |
| | | TEXTURE_VERTEX_SHADER, |
| | | /* fragment shader */ |
| | | "varying vec4 v_color;\n" |
| | | "varying vec2 v_texCoord;\n" |
| | | "uniform sampler2D tex0;\n" |
| | | "\n" |
| | | "void main()\n" |
| | | "{\n" |
| | | " gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n" |
| | | "}" |
| | | }, |
| | |
| | | ctx->glCompileShaderARB(shader); |
| | | ctx->glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); |
| | | if (status == 0) { |
| | | SDL_bool isstack; |
| | | GLint length; |
| | | char *info; |
| | | |
| | | ctx->glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); |
| | | info = SDL_stack_alloc(char, length+1); |
| | | info = SDL_small_alloc(char, length+1, &isstack); |
| | | ctx->glGetInfoLogARB(shader, length, NULL, info); |
| | | SDL_LogError(SDL_LOG_CATEGORY_RENDER, |
| | | "Failed to compile shader:\n%s%s\n%s", defines, source, info); |
| | |
| | | fprintf(stderr, |
| | | "Failed to compile shader:\n%s%s\n%s", defines, source, info); |
| | | #endif |
| | | SDL_stack_free(info); |
| | | SDL_small_free(info, isstack); |
| | | |
| | | return SDL_FALSE; |
| | | } else { |