Calculate the line by two points, multiplying each by one of your model matrices. Below is the pseudo code. Since you use Qt, you can use the built-in math libraries to achieve this effect.
vec3 line_point_1 = model_matrix_object1 * vec4(0, 0, 0, 1); vec3 line_point_2 = model_matrix_object2 * vec4(0, 0, 0, 1);
Oskar source share