MCPcopy Create free account
hub / github.com/abess-team/abess / createShader

Function createShader

python/include/unsupported/test/openglsupport.cpp:72–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72GLint createShader(const char* vtx, const char* frg)
73{
74 GLint prg_id = glCreateProgram();
75 GLint vtx_id = glCreateShader(GL_VERTEX_SHADER);
76 GLint frg_id = glCreateShader(GL_FRAGMENT_SHADER);
77 GLint ok;
78
79 glShaderSource(vtx_id, 1, &vtx, 0);
80 glCompileShader(vtx_id);
81 glGetShaderiv(vtx_id,GL_COMPILE_STATUS,&ok);
82 if(!ok)
83 {
84 std::cerr << "vtx compilation failed\n";
85 }
86
87 glShaderSource(frg_id, 1, &frg, 0);
88 glCompileShader(frg_id);
89 glGetShaderiv(frg_id,GL_COMPILE_STATUS,&ok);
90 if(!ok)
91 {
92 std::cerr << "frg compilation failed\n";
93 }
94
95 glAttachShader(prg_id, vtx_id);
96 glAttachShader(prg_id, frg_id);
97 glLinkProgram(prg_id);
98 glGetProgramiv(prg_id,GL_LINK_STATUS,&ok);
99 if(!ok)
100 {
101 std::cerr << "linking failed\n";
102 }
103 printInfoLog(prg_id);
104
105 glUseProgram(prg_id);
106 return prg_id;
107}
108
109void test_openglsupport()
110{

Callers 1

test_openglsupportFunction · 0.85

Calls 1

printInfoLogFunction · 0.85

Tested by

no test coverage detected