Hi!
I'm trying to draw a simple quad into the screen with no perspective, only for setting an image on it, but it doesn't show up. It's not an issue about color or texture, because the quad is drawn with perspective if I use perspective matrix instead. In fact, the renderer says it's drawing the mesh... My code is very simple. Here I define the vertex positions, indices and texture coordinates:
posText = new float[]{
0.0f, 0.0f,
0.0f, 0.5f,
0.5f, 0.5f,
0.5f, 0.0f
};
indicesText = new int[]{
0, 1, 3, 1, 2, 3
};
textCoords = new float[]{
0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 1.0f,
1.0f, 0.0f,
};
And when rendering it, the orthographic matrix is called and built as:
Matrix4f orthoProjMatrix = orthoProjectionMatrix(0, window.getWidth(), window.getHeight(), 0);
public Matrix4f orthoProjectionMatrix(float left, float right, float bottom, float top){
orthoProjectionMatrix.identity();
orthoProjectionMatrix.setOrtho2D(left, right, bottom, top);
return orthoProjectionMatrix;
}
The vertex shader is simple:
#version 330
layout (location=0) in vec3 position;
layout (location=1) in vec2 texCoord;
out vec2 outTexCoord;
uniform mat4 projectionMatrix;
uniform mat4 worldMatrix;
void main()
{
gl_Position = projectionMatrix * worldMatrix * vec4(position.xy, 0.0, 1.0);
outTexCoord = texCoord;
}
Where projectionMatrix takes the value of the othographic matrix. What am I doing wrong?