in a shader u would transform your vertex positions as normal with the projection matrix.
also I would recomment NOT to use your screen size for creating your matrix. Just think about how many world-units the player should see in one direction and calculate the size of the other with your screen ratio.
for example you want the player to see 10 in width u have to set a height of 7.5 (ratio: 4/3), I think this is importandt because you wouldn't want the player to see more of the game depeding on their screen resolution.
Another thing I like to do is to set the center of the screen in the center of the projection, so instead of
ortho(0, 10, 0, 7.5 ...
I use
ortho(-5, 5, -3.75, 3.75 ...
Oh but Im doing 2D so I want to map vertices to pixel coordinates
with this I have no geometry being rendered (if I toggle the ortho projection it displays the polygon tho)
GLint _uniform_location_matrix = -1;
glm::mat4 _projection(1.0f);
_projection = glm::ortho(0, 800, 600, 0, -100, 100);
CreateVBO();
Shader _basic_shader("..\\Resources\\Shaders\\Basic.v.glsl", "..\\Resources\\Shaders\\Basic.f.glsl");
_basic_shader.Compile(); if ( _basic_shader.GetProgramId() == NULL ) return;
glUseProgram(_basic_shader.GetProgramId());
_uniform_location_matrix = glGetUniformLocation(_basic_shader.GetProgramId(), "mvpMatrix");
glUniformMatrix4fv(_uniform_location_matrix, 1, GL_FALSE, glm::value_ptr(_projection));
while(true)Render();
#version 400
uniform mat4 mvpMatrix;
layout(location=0) in vec4 in_Position;
layout(location=1) in vec4 in_Color;
out vec4 ex_Color;
void main(void)
{
gl_Position = mvpMatrix * in_Position;
ex_Color = in_Color;
}
#version 400
in vec4 ex_Color;
out vec4 out_Color;
void main(void)
{
out_Color = ex_Color;
}