I am creating a 2D map editor in C ++ with GLFW. I want move and drag entities with the mouse, but I have a problem, the mouse coords are in the window size range (1200, 720) and the entity is in the GLSL range (100x100 I think), I compare the mouse coord with the 4 entity edges. How can I do this?
PD: Sorry for bad english.
Edit:
There is the code for set position and size to entities:
model = glm::mat4(1.0f);
model = glm::translate(model, glm::vec3(translate, 0.0f));
model = glm::scale(model, glm::vec3(scale, 1.0f));
And this is the GLSL code:
#version 330
layout (location = 0) in vec2 position;
layout (location = 1) in vec2 textureCoord;
out vec2 TexCoord;
uniform mat4 model;
uniform mat4 projection;
uniform mat4 view;
void main() {
TexCoord = textureCoord;
gl_Position = projection * view * model * vec4(position, 1.0, 1.0);
}
view
andprojection
uniforms? \$\endgroup\$ – DMGregory♦ Jul 9 '20 at 13:19