c++ - Vertex shader fails to compile, but no message from Info Log -


i'm trying set simple vertex shader. when compile it, fails (according gl_compile_status), info log empty, leaving me nothing work debugging standpoint.

here code:

gluint vertexshader, fragmentshader;  char *code =  "void main(void)\ {\     vec4 = gl_vertex;\     a.x = a.x * 0.5;\     a.y = a.y * 0.5;\     gl_position = gl_modelviewprojectionmatrix * a;\ }";   int length = strlen(code);  vertexshader = glcreateshader(gl_vertex_shader); //fragmentshader = glcreateshader(gl_fragment_shader); glshadersource(vertexshader, 1, &code, &length);  glcompileshader(gl_vertex_shader);  glint compiled; glint loglength;  glgetshaderiv(vertexshader, gl_compile_status, &compiled);  glgetshaderiv(vertexshader, gl_info_log_length , &loglength); if (loglength > 1) {     glchar* compiler_log = (glchar*)malloc(loglength);     glgetshaderinfolog(vertexshader, loglength, 0, compiler_log);     printf("%s\n", compiler_log);     free (compiler_log); } 

i'm aware pretty messy, , since i'm new shaders i'm sure there's wrong shader code. however, thing bugging hell out of me lack of debugging information. code above results in compiled being gl_false (meaning code failed compile) , loglength being 0 (meaning info log empty). gives? isn't whole point of info log?

glcompileshader take shader number returned glcreateshader not shader type.

in case

glcompileshader(gl_vertex_shader); 

should be

glcompileshader(vertexshader); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -