Shadow map/Depth Map giving weird result

I’m trying to render my depth map, for now I’ve rendered it onto the objects in the scene to get a overview of what the result I’m getting is. From what I’ve learned, the black values are objects that are close to the light, and white is further away. Please correct me if I’ve gotten it wrong. This is the result I’m getting: [ATTACH=CONFIG]1506[/ATTACH]

With this result, I speculate that I’ve created the framebuffer in the wrong way. this is how I generate it:

void createFrameBuffer()
{
    glGenFramebuffers(1, &frameBuffer);


    glGenTextures(1, &DepthMap);
    glBindTexture(GL_TEXTURE_2D, DepthMap);

    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
        SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,                                 
        GL_TEXTURE_2D, DepthMap, 0);

    glDrawBuffer(GL_NONE);
    glReadBuffer(GL_NONE);

    glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

We have followed the Learn OpenGL - Shadow Mapping tutorial, and our shaders looks almost identical to his. So there shouldn’t be any problem there. I think I’ve misunderstood something in the CPU part of shadow mapping, and not the GPU.This is how I draw everything, set up matrices and use programs.

float orthoValue = 20.0f;

glm::mat4 lightProjection = glm::ortho(-orthoValue,
    orthoValue, -orthoValue, orthoValue, NEARPLANE, FARPLANE);
glm::mat4 lightView = glm::lookAt(lightPos, glm::vec3(0.0f),
    glm::vec3(0.0, 1.0f, 0.0));
glm::mat4 lightSpaceMatrix = lightProjection * lightView;
//lightSpaceMatrix[3] = glm::vec4(lightPos, 1.0f);

if (shadows == true) {

    glUseProgram(sShaderProgram);
    glBindVertexArray(mesh.VAO);
    glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
    glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
    glClear(GL_DEPTH_BUFFER_BIT);
    glActiveTexture(GL_TEXTURE0);


    glUniformMatrix4fv(glGetUniformLocation(sShaderProgram, "lightSpaceMatrix"),
        1, GL_FALSE, glm::value_ptr(lightSpaceMatrix));
    glUniformMatrix4fv(glGetUniformLocation(sShaderProgram, "modelMatrix"),
        1, GL_FALSE, glm::value_ptr(mesh.modelMatrix));

    glDrawArrays(GL_TRIANGLES, 0, mesh.vertices.size());
    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    glBindVertexArray(0);

    setViewPort();
}

I’m really grateful for all of the tips and help in advance. If I’ve left out crucial information, I’ll add whatever’s missing.