I’m drawing bounding boxes for objects in a scene to better debug a physics engine I’m in the middle of writting. The code is nothing all that crazy; for each object with collisions enabled, I just do
glBegin(GL_LINES); glVertex3f(x1,y1,z1); (...) glVertex3f(xn, yn, zn); glEnd();
And it works, the boxes are drawn correctly. However, the resulting lines – whose xyz values are world coordinates, ie not relative to object space – will automatically adopt the origin of the last drawn object as world origin, meaning every other box already drawn gets translated by that vector.
My guess is the shader I use to render the 3d objects is messing with me and multiplying the coordinates by the model matrix, but I’m not really sure what’s going on. So, how do we ensure that these vertex positions are not modified after