I
I
IliaNeverov2021-02-19 20:27:58
OpenGL
IliaNeverov, 2021-02-19 20:27:58

What to do with multiple transformation matrices?

Hello! Let's say that I have several objects on the stage and I need them all (or only a few) to somehow transform (someone moved, moved, etc.), therefore, each of those who move / move / scale should have a transformation matrix, but what about her?
Now the vertex shader code (there is only one object and one transformation matrix on the stage) looks like this

#version 330
layout (location = 0) in vec3 position;

// выход на вход в фрагментный шейдер
// Приписка 'pass_' для моего удобства
in vec2 uv;
out vec2 pass_uv;

//матрицы
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform mat4 projectionMatrix;

void main() {
 
  gl_Position = projectionMatrix * ViewMatrix * ModelMatrix * vec4(position, 1.0f);

  pass_uv = uv;
}

Please tell me what should be done (with what to multiply, where and how) with the transformation matrices (which are responsible for the transformation of these very few objects)?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question