In openGL, how can you get items to draw back to front?

前端 未结 6 1575
感情败类
感情败类 2020-12-30 05:05

By default it seems that objects are drawn front to back. I am drawing a 2-D UI object and would like to create it back to front. For example I could create a white square

6条回答
  •  情歌与酒
    2020-12-30 05:30

    The following call will turn off depth testing causing objects to be drawn in the order created. This will in effect cause objects to draw back to front.

    glDepthFunc(GL_NEVER);      // Ignore depth values (Z) to cause drawing bottom to top
    

    Be sure you do not call this:

    glEnable (GL_DEPTH_TEST);   // Enables Depth Testing
    

提交回复
热议问题