ChurroLoco
September 16th, 2010, 08:21 AM
I'm trying to load a GLSL shader with the source code hard coded into the .cpp file. I normally read it from a file and store in a buffer, but the challenge is a one source file program. So I store my shader like this as a global.
const char* g_VERT_SHADER_SOURCE = "void main()\r\n{\r\n\tgl_Position = gl_ModelViewProjectionMatrix * gl_Vertex * 3.0;\r\n}\0";
My question though is how big is this buffer. When I send this text to OpenGL for shader compilation I need to tell it how big the source is. Does '\r' and '\n' count as one or two char. I know at some point they turn into a single char code, but when?
Thanks!
const char* g_VERT_SHADER_SOURCE = "void main()\r\n{\r\n\tgl_Position = gl_ModelViewProjectionMatrix * gl_Vertex * 3.0;\r\n}\0";
My question though is how big is this buffer. When I send this text to OpenGL for shader compilation I need to tell it how big the source is. Does '\r' and '\n' count as one or two char. I know at some point they turn into a single char code, but when?
Thanks!