--- Static Functions ---
| 293 | |
| 294 | // --- Static Functions --- |
| 295 | uint32_t shader_create(GLenum type, const char* src) { |
| 296 | // Create && compile the shader with opengl |
| 297 | uint32_t shader = glCreateShader(type); |
| 298 | glShaderSource(shader, 1, &src, NULL); |
| 299 | glCompileShader(shader); |
| 300 | |
| 301 | // Check for compilation errors |
| 302 | int32_t compiled; |
| 303 | glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); |
| 304 | |
| 305 | if(!compiled) { |
| 306 | LF_ERROR("Failed to compile %s shader.", type == GL_VERTEX_SHADER ? "vertex" : "fragment"); |
| 307 | char info[512]; |
| 308 | glGetShaderInfoLog(shader, 512, NULL, info); |
| 309 | LF_INFO("%s", info); |
| 310 | glDeleteShader(shader); |
| 311 | } |
| 312 | return shader; |
| 313 | } |
| 314 | |
| 315 | LfShader shader_prg_create(const char* vert_src, const char* frag_src) { |
| 316 | // Creating vertex & fragment shader with the shader API |