gpt4 book ai didi

java - glRotatef 适用于多个对象

转载 作者:行者123 更新时间:2023-11-29 07:02:27 24 4
gpt4 key购买 nike

基本上我想打开一扇门,我想到了使用 glRotatef。我的问题是它影响了在它之后绘制的每个对象。有谁知道如何阻止它?

门类

    public static void draw(Texture door) {  

door.bind();
if(Door_Test.state == "out" && d != 90){
glRotatef(i, 0, 1, 0);
i+=5;
}
glBegin(GL_QUADS);
glColor3f(1f, 1f, 1f);glTexCoord2f(0,0);glVertex3f(-2,3, -15);
glColor3f(1f, 1f, 1f);glTexCoord2f(0,1);glVertex3f(-2,-3, -15);
glColor3f(1f, 1f, 1f);glTexCoord2f(1,1);glVertex3f(2,-3, -15);
glColor3f(1f, 1f, 1f);glTexCoord2f(1,0);glVertex3f(2,3, -15);
glEnd();

}

最佳答案

常见的做法:

glPushMatrix();
glRotatef(/*...*/);
// Drawing commands here
glPopMatrix();

关于java - glRotatef 适用于多个对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23943941/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com