如何排布两组图形的显示顺序

opengl几何变换及裁剪变换
#include "windows.h"

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>

void myinit(void);
void DrawMyObjects(void);
void CALLBACK display(void);
void CALLBACK myReshape(GLsizei w, GLsizei h);

void DrawMyObjects(void)
{
glBegin(GL_LINE_LOOP);
glVertex2f(0.0, 0.0);
glVertex2f(0.0,20.0);
glVertex2f(40.0, 20.0);
glVertex2f(40.0, 0.0);
glEnd();
}

void CALLBACK display(void)
{
glClearColor (0.0, 0.0, 0.0, 1.0);
glClear (GL_COLOR_BUFFER_BIT);

/* draw an original rectangle */
glLoadIdentity ();
glColor3f (1.0, 1.0, 0.0);  /* yellow */

DrawMyObjects();

/* translating a rectangle along X_axis */
glLoadIdentity ();
glTranslatef (-45.0, 0.0, 0.0);
glColor3f(1.0,0.0,0.0);   /* red */
DrawMyObjects ();

/* translating a rectangle along X_axis /
glLoadIdentity ();
glTranslatef (0.0, -25.0, 0.0);
glColor3f(0.0,1.0,0.0); /
green /
DrawMyObjects ();
/
translating a rectangle along X_axis /
glLoadIdentity ();
glTranslatef (-45.0, -25.0, 0.0);
glColor3f(0.0,0.0,1.0); /
blue */
DrawMyObjects ();
glLoadIdentity ();
GLdouble eqn[4] = {-1, 0.0, 0.0, 0.0};

glColor3f (1.0, 1.0, 1.0);
glPushMatrix();
glTranslatef (0.0, 0.0, -5.0);

/* clip the left part of wire_sphere : x<0 */
glClipPlane (GL_CLIP_PLANE0, eqn);
glEnable (GL_CLIP_PLANE0);
glRotatef (0.0, 1.0, 0.0, 0.0);
auxWireTeapot(15.0);
glPopMatrix();
glDisable (GL_CLIP_PLANE0);
glFlush();
}

void myinit (void)
{
glShadeModel (GL_FLAT);
}

void CALLBACK myReshape(GLsizei w, GLsizei h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho(-50.0, 50.0, -50.0*(GLfloat)h/(GLfloat)w, 50.0*(GLfloat)h/(GLfloat)w,-1.0,1.0);
else
glOrtho(-50.0*(GLfloat)w/(GLfloat)h, 50.0*(GLfloat)w/(GLfloat)h, -50.0, 50.0,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
}

void main(void)
{
auxInitDisplayMode (AUX_SINGLE | AUX_RGBA);
auxInitPosition (0, 0, 500, 500);
auxInitWindow ("Geometric Transformations");
myinit ();
auxReshapeFunc (myReshape);
auxMainLoop(display);
}

运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果:让茶壶(白色图形显示出来)

img

img

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。