I am creating a first-person shooter using OpenGL, and I am trying to make the gun model float in front of the camera. I tore the model from Fallout 3 using a resource decompiler (converted to .obj and loaded).
However, this is what the screen looks like:

Half of the gun's triangles are clipped to what seems truncated.
I put it in front of my camera as follows:
glPushMatrix();
glLoadIdentity();
glTranslatef(m_GunPos.x, m_GunPos.y, m_GunPos.z);
glRotatef(m_GunRot.x, 1, 0, 0);
glRotatef(m_GunRot.y, 0, 1, 0);
glRotatef(m_GunRot.z, 0, 0, 1);
glScalef(m_GunScale.x, m_GunScale.y, m_GunScale.z);
m_Gun->Render(NULL);
glPopMatrix();
So, I save the original matrix GL_MODELVIEW, load the identification matrix, translate the gun a little to the right of the camera and visualize it. This is my rendering routine for SceneNode:
glPushMatrix();
if (m_Model) { m_Model->Render(&final); }
if (m_Children.size() > 0)
{
for (std::vector<SceneNode*>::iterator i = m_Children.begin(); i != m_Children.end(); ++i)
{
(*i)->Render(&final);
}
}
glPopMatrix();
Thus, it displays its own model and any child SceneNode. Finally, the actual rendering of the grid is as follows:
if (m_Material)
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_Material->m_TexDiffuse);
}
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(Vec3), &m_Vertex[0]);
glNormalPointer(GL_FLOAT, sizeof(Vec3), &m_Normal[0]);
glTexCoordPointer(2, GL_FLOAT, 0, &m_UV[0]);
glDrawArrays(GL_TRIANGLES, 0, m_Vertex.size());
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
? ?
.