I'm new to OpenGl Faced this problem:
Draw function:
void Renderer::Draw()
{
glUseProgram(programID);
shader.UseProgram();
mat4 view = mat4(mat3(myCamera->GetViewMatrix()));
glm::mat4 VP = myCamera->GetProjectionMatrix()*myCamera->GetViewMatrix();
shader.BindVPMatrix(&VP[0][0]);
glm::mat4 VP2 = myCamera->GetProjectionMatrix() * myCamera->GetViewMatrix() * floorM;
model13D->Render(&shader, scale(100.0f, 100.0f, 100.0f)); // scaling the skybox
t2->Bind();
model3D->Render(&shader, scale(2.0f, 2.0f, 2.0f)); //scaling aircraft
glUniformMatrix4fv(VPID, 1, GL_FALSE, &VP2[0][0]);
mySquare->Draw();
}
The code of loaded:
shader.LoadProgram();
model3D = new Model3D();
model3D->LoadFromFile("data/models/obj/Galaxy/galaxy.obj", true);
model3D->Initialize();
myCamera->SetPerspectiveProjection(90.0f, 4.0f / 3.0f, 0.1f, 10000000.0f);
model13D = new Model3D();
model13D->LoadFromFile("data/models/obj/skybox/Skybox.obj", true);
model13D->Initialize();
// Projection matrix :
//shader.LoadProgram();
// View matrix :
myCamera->Reset(
+0.0f, +0.0f, 5.0f,// Camera Position
+0.0f, +0.0f, +0.0f,// Look at Point
+0.0f, +1.0f, +0.0f // Up Vector
);
//////////////////////////////////////////////////////////////////////////
std::string Images_names[6];
Images_names[0] = "right.png";
Images_names[1] = "left.png";
Images_names[2] = "top.png";
Images_names[3] = "bottom.png";
Images_names[4] = "back.png";
Images_names[5] = "front.png";
t = new Texture(Images_names, 0);
t2 = new Texture("arrakisday_dn.tga", 1);
Model3D
andTexture
are not; if they're part of another API, it would be nice to know which one. \$\endgroup\$