Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSponji

Posted 10 May 2013 - 03:03 PM

Are you really sure that the shaders are correct? Why you're doing stuff like this:

 

GLchar **str = new GLchar*[1];

Not sure how that pointer works, too sleepy. I'd probably write it like this, much simpler:

 

char *str = new char[256]; 
memset(str, 0, 256);
readvertexshader();
memset(str, 0, 256);
readfragmentshader();
// ...
glShaderSource(fShad, 1, (const char**)&str, NULL);
// and now you can really make sure that you have the actual shader source there, just print it out
printf("shader source:\n%s\n", str);

Actually... I think you should have written (const char**)&str[1] before, because of that weird pointer thingie you were doing. I tried your code on my computer and seemed to work ok with those changes, had to change version numbers too though, my card doesn't support OpenGL 4.0.

 

Edit: And oh, seemed like I had to call ifs.close() too, not sure if this is only like this on Linux? I think it clears the eof bit, too lazy to check out. Sleep I goes.


#2Sponji

Posted 10 May 2013 - 03:03 PM

Are you really sure that the shaders are correct? Why you're doing stuff like this:

 

Lchar **str = new GLchar*[1];

Not sure how that pointer works, too sleepy. I'd probably write it like this, much simpler:

 

char *str = new char[256]; 
memset(str, 0, 256);
readvertexshader();
memset(str, 0, 256);
readfragmentshader();
// ...
glShaderSource(fShad, 1, (const char**)&str, NULL);
// and now you can really make sure that you have the actual shader source there, just print it out
printf("shader source:\n%s\n", str);

Actually... I think you should have written (const char**)&str[1] before, because of that weird pointer thingie you were doing. I tried your code on my computer and seemed to work ok with those changes, had to change version numbers too though, my card doesn't support OpenGL 4.0.

 

Edit: And oh, seemed like I had to call ifs.close() too, not sure if this is only like this on Linux? I think it clears the eof bit, too lazy to check out. Sleep I goes.


#1Sponji

Posted 10 May 2013 - 03:00 PM

Are you really sure that the shaders are correct? Why you're doing stuff like this:

 

 

GLchar **str = new GLchar*[1];

Not sure how that pointer works, too sleepy. I'd probably write it like this, much simpler:

 

char *str = new char[256]; 
memset(str, 0, 256);
readvertexshader();
memset(str, 0, 256);
readfragmentshader();
// ...
glShaderSource(fShad, 1, (const char**)&str, NULL);
// and now you can really make sure that you have the actual shader source there, just print it out
printf("shader source:\n%s\n", str);

Actually... I think you should have written (const char**)&str[1] before, because of that weird pointer thingie you were doing. I tried your code on my computer and seemed to work ok with those changes, had to change version numbers too though, my card doesn't support OpenGL 4.0.


PARTNERS