I need to draw a line between two meshes I've created. Each mesh is associated with a different model matrix. I've been thinking on how to do this and I thought of this:
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(first_object_model_matrix);
glBegin(GL_LINES);
glVertex3f(0, 0, 0); // object coord
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(first_object_model_matrix);
glVertex3f(0, 0, 0); // ending point of the line
glEnd( );
But the problem is that I can't call glMatrixMode
and glLoadMatrixf
between glBegin
and glEnd
. I'm also using shaders and the programmable pipeline, so the idea of turning back to the fixed pipeline with my scene rendered isn't exciting.
Can you:
- Suggest me precisely how to draw a line between two meshes (I have their model matrix) with shaders.
or
- Suggest me how to write code similar to the one above to draw a line having two meshes model matrices.