glGetUniformLocation Access violation reading location 0x00000000

-1

When I call glGetUniformLocation() it generates an Access Violation.

This is the function where I call it:

void Material::SetMatrixProperty(const char* name, glm::mat4& mat)
{
    unsigned int matrixId = glGetUniformLocation(programID, name);
    glUniformMatrix4fv(matrixId, 1, GL_FALSE, &mat[0][0]);
}

And here is the function where I call SetMatrixProperty():

void Sprite::Draw()
{
    render->CargarMatrizIdentidad();
    render->SetMatrizDeMundo(matrizMundo);

    if (material != NULL) 
    {
        material->Bind();
        material->SetMatrizProperty("WVP", render->GetMVP());
        material->BindTexture("myTextureSampler", textureBufferId);
    }

    render->EmpezarDibujado(0);
    render->EmpezarDibujado(1);
    render->BindBuffer(IDBuffer, 0);
    render->BindUVBuffer(UVBufferId, 1);
    render->DibujarBuffer(countVertices, primitiva);
    render->TerminarDibujado(0);
    render->TerminarDibujado(1);
}

This only generates an exception when using sprites (they use textures), when I make normal shapes (don't use textures) everything runs smoothly.

c++
opengl
access-violation
glm-math
asked on Stack Overflow Nov 30, 2018 by JulianIF • edited Nov 30, 2018 by genpfault

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0