Polygons are not displayed when adding a view matrix. The square is at (0,0,0). Without a view matrix, it appears in the upper left corner. There is a shader:
#version 330 core layout (location = 0) in vec4 vertex; // <vec2 position, vec2 texCoords> out vec2 TexCoords; uniform mat4 model; uniform mat4 view; uniform mat4 projection; void main() { TexCoords = vec2 (vertex.z, 1.0f - vertex.w); gl_Position = projection * view * model * vec4(vertex.xy, 0.0, 1.0); } I create the matrix like this:
glm::vec3 cameraPos = glm::vec3 (m_ViewXPos, m_ViewYPos, -30.0f); glm::vec3 cameraFront = glm::vec3 (m_ViewXPos, m_ViewYPos, 30.0f); glm::vec3 cameraUp = glm::vec3 (0.0f, 1.0f, 0.0f); m_ViewMatrix = glm::lookAt (cameraPos, cameraFront, cameraUp); m_ViewXPos and m_ViewYPos are 0.0f
This is what happens:
{-1.0, 0.0, -0.0, 0.0}, { 0.0, 1.0, -0.0, 0.0}, { 0.0, -0.0, -1.0, 0.0}, {-0.0, -0.0, -30.0, 1.0} Projection Matrix:
m_ProjectionMatrix = glm::ortho (0.0f, (GLfloat) m_ViewportSize.x, (GLfloat)m_ViewportSize.y, 0.0f, -100.0f, 100.0f); I tried to change the dimensions of the projection matrix (set from -5000 to 5000). Nothing appears in this range.
What am I doing wrong to display with this matrix?