View Full Version : GLM camera problems.

05-26-2013, 07:40 AM
I'm having a problem with
My object displays well but when i rotate the view it disappears at about 3/4 of the screen.
My code:

Projection = glm::perspective(45.0f, (GLfloat)1366/768, 1.0f,6000.0f);
camera->Position = F3dVector(0,0,30);
ModelMat = glm::mat4(1.0f);
View = camera->Render();
MVP = (Projection * View * ModelMat);

I think it's a clipping error but I don't know how to solve it.

05-28-2013, 06:54 AM
Try replacing "(GLfloat)1366/768" by 1.0f

05-28-2013, 07:17 AM
Or try making the third parameter to glm::perspective smaller, 0.001f or so. It could be when you rotate the scene some polygons pass outside the near plane of your viewing frustum.

05-28-2013, 07:25 AM
Sorry, I misunderstood. "When you rotate" Yes, this can be because of the distance of the nearplane to the camera position.I have came across the same problem before if the actual problem is that. But also there is another problem due to a reason I don't know . I get the result I want only when I make the second parameter 1 when using glm. According to convention of old fixed functionality, this must have been
the width of the screen / the height of the screen.