我正在制作一个wolfenstien克隆,我正在尝试实现图像面向相机的方式......将其旋转到相机上工作,但是当我向左或向右转动图像时,会出现震动它应该被投射出来。
glPushMatrix();
glTranslatef(billboard_origin.x, 0, billboard_origin.z); // Translation here
glRotatef(360.0f - yrotation, 0, 1.0f, 0);
glBegin(GL_QUADS);
glTexCoord2f(x2, y3);
glVertex3f(billboard_origin.x - (width / 2), billboard_origin.y + (height), 0); //No translation here anymore
glTexCoord2f(x2, y2);
glVertex3f(billboard_origin.x - (width / 2), billboard_origin.y - (height), 0);
glTexCoord2f(x3, y2);
glVertex3f(billboard_origin.x + (width / 2), billboard_origin.y - (height), 0);
glTexCoord2f(x3, y3);
glVertex3f(billboard_origin.x + (width / 2), billboard_origin.y + (height), 0);
glEnd();
广告牌在我渲染体素的同一循环中呈现,所以我认为我应该更改矩阵以便正确投影图像,但我无法判断这是否是问题。注意:我知道如果我向上或向下看它不会旋转,但正如我所说,它是一个Wolfenstien克隆,我不需要实现它。