How to fix "cropping" shapes in OpenGL (lwjgl)?

Aryesia :

I am doing a project on OpenGL 3D. I have several figures, and when I rotate the camera (scene), the figures seem to go beyond it (or beyond Viewport)

Normal condition:

Normal condition

Cropped figure:

Cropped figure

How can I increase the viewing area? Or what can be done in this situation?

Now I am trying:

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glDepthFunc(GL_LEQUAL);
        glfwPollEvents();
        glPushMatrix();
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL11.glViewport(0, 0, width, height);
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        glLoadIdentity();

But it does not bring results.

Rabbid76 :

It seems that the object is clipped by the near plane of then orthographic projection. Change the near plane to solve the issue. The orthographic projection matrix is set by glOrtho.

By default the projection matrix is the Identity matrix. That is the same as you would do

GL11.glOrtho(-1, 1, -1, 1, 1, -1);

Increase the distance to the near and far plane to solve the issue. e.g:

GL11.glMatrixMode(GL11.GL_PROJECTION);
glLoadIdentity();
GL11.glOrtho(-1, 1, -1, 1, 10, -10);

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=417893&siteId=1