Home>

Although it is a sp->DrawGraph ();class, this is a sprite that is displayed on the screen in the form of a 2D UI, but it will not be displayed on the screen when the depth buffer is enabled, so in that case it is like the presentation code. I'm off. The cube class displays a cube with 3D polygons. Both are drawn with separate shaders.

// Drawing update
void Game :: GenerateOutput ()
{
    // Screen clear relation
    glClearColor (0.0f, 0.0f, 1.0f, 1.0f);
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glEnable (GL_DEPTH_TEST);// z buffer
    cube->Draw ();

    glDisable (GL_DEPTH_TEST);// z buffer
    sp->DrawGraph (0,600);
  // rct->DrawGraph (100,100);
    printf ("aaa \ n");
    glViewport (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);// Viewport
    glfwSwapBuffers (Window);// Double buffering
    glfwPollEvents ();// Event handling
}
  • Answer # 1

    sp->DrawGraph (0,600);
    If the problem occurs even if there is no other person to draw something (from "Request for addition/correction to question"),
    It's not a story of "hidden by other objects and invisible".
    thissp->DrawGraph (0,600);The inside of is "implementation that cannot be displayed properly if the depth test is valid" (*)Isn't it? I can only imagine that.

    sp->DrawGraph (0,600);Is it displaying multiple faces or something, and the order is a problem?
    (Imagine from the story of "2D ...", for example, drawing multiple things at the same depth)
    If you are drawing something more than one, why not try drawing only one of them and it will be displayed?

    (*): If it is a premise to draw with the depth test OFF, I think that there is no problem with such an implementation.

Related articles