This commit is contained in:
ZtRXR 2024-06-29 20:32:54 +08:00
parent cf91c1a687
commit 3e8c6d09eb

View File

@ -8,12 +8,18 @@
static unsigned int CompileShader(unsigned int fragmentShader,const std::string& source){ static unsigned int CompileShader(unsigned int fragmentShader,const std::string& source){
auto id = glCreateShader(GL_VERTEX_SHADER); auto id = glCreateShader(GL_VERTEX_SHADER);
auto src = source.c_str(); auto src = source.c_str();
glShaderSource(id,1,&src,nullptr);
glCompileShader(id);
// TODO Error handing
return id;
} }
static int CreateShader(const std::string& vertexShader, const std::string& fragmentShader){ static int CreateShader(const std::string& vertexShader, const std::string& fragmentShader){
auto program = glCreateProgram(); auto program = glCreateProgram();
auto vs = CompileShader(GL_VERTEX_SHADER,vertexShader); auto vs = CompileShader(GL_VERTEX_SHADER,vertexShader);
auto fs = CompileShader(GL_FRAGMENT_SHADER,fragmentShader);
} }
int tests::glfw_shader(unsigned width,unsigned height, std::string title) int tests::glfw_shader(unsigned width,unsigned height, std::string title)