Shader create_shader_from_file(const char* _file_name, shader_type _type) { char* buf = _load_text_file(_file_name); Shader ret = Shader_new(); Shader_load_from_string(ret, (const char*)buf, _type); return ret; }
int Renderer_createShader( const char *pVFile, const char *pFFile ) { Shader *s = NULL; if( renderer && ShaderArray_checkSize( &renderer->mShaders ) ) { s = Shader_new(); check_mem( s ); // shader creation and linking check( Shader_buildFromFile( s, pVFile, pFFile ), "Error in shader creation.\n" ); // storage int index = renderer->mShaders.cpt++; renderer->mShaders.data[index] = s; return index; } error: Shader_destroy( s ); return -1; }