Advertisement
spacechase0

OpenGL 3.3 Shaders: syntax error, unexpected $undefined at t

Jan 24th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. // Before - Broken
  2. const char* vertTmp = vertContents.c_str();
  3. const char* fragTmp = fragContents.c_str();
  4. glShaderSource( vert, 1, &vertTmp, NULL ); // If it's NULL, then the string is NULL-terminated
  5. glShaderSource( frag, 1, &fragTmp, NULL );
  6.  
  7. // After - Fixed
  8. const char* vertTmp = vertContents.c_str(); int vertLen = vertContents.length()-1;
  9. const char* fragTmp = fragContents.c_str(); int fragLen = fragContents.length()-1;
  10. glShaderSource( vert, 1, &vertTmp, &vertLen ); // Telling it the length of the string, or length - 1 ?
  11. glShaderSource( frag, 1, &fragTmp, &fragLen );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement