0
\$\begingroup\$

I am trying to load a model and it is loading it in reverse. When I am trying to rotate it 180 degrees it changes the lightning as well. I am not sure what I need to do to change the position that eh model is facing when is being loaded.

This is the object loader:

if (!submarineShader->load("BasicView", "glslfiles/basicTransformations.vert", "glslfiles/basicTransformations.frag"))
{
    cout << "failed to load shader" << endl;
}
glUseProgram(submarineShader->handle());  // use the shader

glEnable(GL_TEXTURE_2D);

cout << " loading model " << endl;
if (objLoader.loadModel("submarine_/submarine v2/submarine5.obj", model))//returns true if the model is loaded, puts the model in the model parameter
{
    cout << " model loaded " << endl;

    model.calcVertNormalsUsingOctree();  

    model.initDrawElements();
    model.initVBO(submarineShader);
    model.deleteVertexFaceData();

}
else
{
    cout << " model failed to load " << endl;
}

Model in reverse position

Correct position of the model

\$\endgroup\$
  • \$\begingroup\$ My gut feeling is that your function to compute normals is wrong, try it with a very simple shape that can be hand written, like a cube, and see how it behaves. \$\endgroup\$ – Ian Young Nov 12 at 8:52
0
\$\begingroup\$

I fixed the problem by editing my model and with 3dsmax and change it's position.

\$\endgroup\$
  • \$\begingroup\$ What position was needed to fix the problem? How did you identify the need to correct the position? \$\endgroup\$ – DMGregory Nov 13 at 13:25
  • \$\begingroup\$ it was not position correctly when I open it with 3DSmax, what I did is I just translate it a bit until it was perpendicular with the x and y axis at (0,0) and then exported it. \$\endgroup\$ – T.ChD Nov 14 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.