GLuint ShaderAPITest::make_shader(GLenum type, const char *src) { GLuint id; assert_no_error(); id = glCreateShader(type); glShaderSource(id, 1, &src, NULL); glCompileShader(id); check_compile_status(id); assert_no_error(); return id; }
GLuint compile_shader(GLenum type, const char* source) { GLuint handle = glCreateShader(type); if(!handle) { std::cerr << "Shader object creation failed." << std::endl; return handle; } glShaderSource( handle, 1, &source, NULL ); glCompileShader( handle ); if(!check_compile_status(handle)) { std::cerr << "Shader compilation failed." << std::endl; return 0; } return handle; }