MCPcopy Create free account
hub / github.com/cococry/leif / shader_create

Function shader_create

leif.c:295–313  ·  view source on GitHub ↗

--- Static Functions ---

Source from the content-addressed store, hash-verified

293
294// --- Static Functions ---
295uint32_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
315LfShader shader_prg_create(const char* vert_src, const char* frag_src) {
316 // Creating vertex & fragment shader with the shader API

Callers 1

shader_prg_createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected