Skip to main content
added 548 characters in body
Source Link

UPDATE #3:

bool Program::ShaderInfoLog(GLuint shader, GLenum shaderType)
{
    GLint compiled;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);

    if (!compiled)
    {
        GLsizei length;
        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);

        GLchar* log = new GLchar[length+1];

        glGetShaderInfoLog(shader, length, &length, log);

        cerr << GetShaderType(shaderType) << ": " << endl << log << endl;

        delete[] log;

        return false;
    }

    return true;
}

UPDATE #3:

bool Program::ShaderInfoLog(GLuint shader, GLenum shaderType)
{
    GLint compiled;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);

    if (!compiled)
    {
        GLsizei length;
        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);

        GLchar* log = new GLchar[length+1];

        glGetShaderInfoLog(shader, length, &length, log);

        cerr << GetShaderType(shaderType) << ": " << endl << log << endl;

        delete[] log;

        return false;
    }

    return true;
}
added 42 characters in body
Source Link

UPDATE #2: I'm writing some scenarios here, some works, some doesn't (by working I mean the model is rendered). I'm getting insane, I really hope it isn't something very silly that is wrong. :)

UPDATE #2: I'm writing some scenarios here, some works, some doesn't. I'm getting insane, I really hope it isn't something very silly that is wrong. :)

UPDATE #2: I'm writing some scenarios here, some works, some doesn't (by working I mean the model is rendered). I'm getting insane, I really hope it isn't something very silly that is wrong. :)

added 841 characters in body
Source Link

UPDATE #1: showing below how I retrieve the uniform location:

void Program::AddUniformLocation(GLchar *name)
{
    GLint location = glGetUniformLocation(program, name);

    if (location != -1)
    {
        uniformList.insert(pair<GLchar*, GLint>(name, location));
    }
    else
    {
        printf("Error: the uniform \"%s\" doesn't exist, or isn't used, in program\n", name);
    }
}

UPDATE #2: I'm writing some scenarios here, some works, some doesn't. I'm getting insane, I really hope it isn't something very silly that is wrong. :)

vec3 diffuse = uniDiffuse * max(dot(N, L), 0.0);
vec3 specular = uniSpecular * pow(max(dot(R, V), 0.0), uniShininess);

// This works, 1.0 instead of uniAlpha.
fragColor = vec4(uniEmissive + uniAmbient + diffuse + specular, 1.0);

// Doesn't work, added uniAlpha
fragColor = vec4(uniEmissive + uniAmbient + diffuse + specular, uniAlpha);

// These are working
fragColor = vec4(uniEmissive, uniAlpha);
fragColor = vec4(uniEmissive + uniAmbient, uniAlpha);
// Adding diffuse doesn't work.
fragColor = vec4(uniEmissive + uniAmbient + diffuse, uniAlpha);
// Just diffuse, works!
fragColor = vec4(diffuse, uniAlpha);

UPDATE: showing below how I retrieve the uniform location:

void Program::AddUniformLocation(GLchar *name)
{
    GLint location = glGetUniformLocation(program, name);

    if (location != -1)
    {
        uniformList.insert(pair<GLchar*, GLint>(name, location));
    }
    else
    {
        printf("Error: the uniform \"%s\" doesn't exist, or isn't used, in program\n", name);
    }
}

UPDATE #1: showing below how I retrieve the uniform location:

void Program::AddUniformLocation(GLchar *name)
{
    GLint location = glGetUniformLocation(program, name);

    if (location != -1)
    {
        uniformList.insert(pair<GLchar*, GLint>(name, location));
    }
    else
    {
        printf("Error: the uniform \"%s\" doesn't exist, or isn't used, in program\n", name);
    }
}

UPDATE #2: I'm writing some scenarios here, some works, some doesn't. I'm getting insane, I really hope it isn't something very silly that is wrong. :)

vec3 diffuse = uniDiffuse * max(dot(N, L), 0.0);
vec3 specular = uniSpecular * pow(max(dot(R, V), 0.0), uniShininess);

// This works, 1.0 instead of uniAlpha.
fragColor = vec4(uniEmissive + uniAmbient + diffuse + specular, 1.0);

// Doesn't work, added uniAlpha
fragColor = vec4(uniEmissive + uniAmbient + diffuse + specular, uniAlpha);

// These are working
fragColor = vec4(uniEmissive, uniAlpha);
fragColor = vec4(uniEmissive + uniAmbient, uniAlpha);
// Adding diffuse doesn't work.
fragColor = vec4(uniEmissive + uniAmbient + diffuse, uniAlpha);
// Just diffuse, works!
fragColor = vec4(diffuse, uniAlpha);
added 417 characters in body
Source Link
Loading
Tweeted twitter.com/#!/StackGameDev/status/520425856242421760
Source Link
Loading