Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualsanta01

Posted 28 December 2012 - 10:55 AM

Can you confirm that when source is explicitly defined in code lie this:

    const GLchar* shaderSource = "#version 330\n"
        "layout (location = 0) in vec3 inPosition;\n"
        "layout (location = 1) in vec3 inColor;\n"
        "smooth out vec3 theColor;\n"
        "void main()\n"
        "{\n"
            "gl_Position = vec4(inPosition, 1.0);\n"
            "theColor = inColor;\n"
        "}\n"

    glShaderSource(uiShader, 1, &shaderSource, NULL);
    glCompileShader(uiShader);

    // dont call delete[] on const arrays, you will get SIGSEGV

    GLint compileStatus;
    glGetShaderiv(uiShader, GL_COMPILE_STATUS, &compileStatus);

    if (compileStatus == GL_FALSE) {
        GLint infoLogLength;
        glGetShaderiv(uiShader, GL_INFO_LOG_LENGTH, &infoLogLength);
        
        GLchar* infoLog = new GLchar[infoLogLength + 1];
        glGetShaderInfoLog(uiShader, infoLogLength, NULL, infoLog);
        
		ofstream outfile;
		outfile.open ("log.txt");
		outfile << infoLog << endl;
		outfile.close();

        delete[] infoLog;
    }

it compiles without errors?


#1santa01

Posted 28 December 2012 - 10:53 AM

Can you confirm that when source is explicitly defined in code lie this:

    const GLchar* shaderSource = "#version 330\n"
        "layout (location = 0) in vec3 inPosition;\n"
        "layout (location = 1) in vec3 inColor;\n"
        "smooth out vec3 theColor;\n"
        "void main()\n"
        "{\n"
        "gl_Position = vec4(inPosition, 1.0);\n"
        "theColor = inColor;\n"
        "}\n"

    glShaderSource(uiShader, 1, &shaderSource, NULL);
    glCompileShader(uiShader);

    // dont call delete[] on const arrays, you will get SIGSEGV

    GLint compileStatus;
    glGetShaderiv(uiShader, GL_COMPILE_STATUS, &compileStatus);

    if (compileStatus == GL_FALSE) {
        GLint infoLogLength;
        glGetShaderiv(uiShader, GL_INFO_LOG_LENGTH, &infoLogLength);
        
        GLchar* infoLog = new GLchar[infoLogLength + 1];
        glGetShaderInfoLog(uiShader, infoLogLength, NULL, infoLog);
        
		ofstream outfile;
		outfile.open ("log.txt");
		outfile << infoLog << endl;
		outfile.close();

        delete[] infoLog;
    }

it compiles without errors?


PARTNERS