我的纹理无法正确渲染

时间:2014-01-27 01:34:53

标签: java opengl lwjgl

我将窗口初始化为800x600

    try {
        Display.setDisplayMode(new DisplayMode(800,600));
        Display.create();
        Mouse.create();
        Keyboard.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

然后我创建一个800x100按钮,800x100纹理

public MenuButton(int x, int y, int height, int width, Texture tex, Texture border){
    this.x = x;
    this.y = y;
    this.x2 = x + width;
    this.y2 = y + height;
    this.tex = tex;
    this.border = border;
}

然后我尝试渲染它

this.border.bind();
Color.white.bind();
glBegin(GL_QUADS);
GL11.glTexCoord2f(0, 0);
glVertex2f(this.x, this.y2);
GL11.glTexCoord2f(1, 0);
glVertex2f(this.x2, this.y2);
GL11.glTexCoord2f(1, 1);
glVertex2f(this.x2, this.y);
GL11.glTexCoord2f(0, 1);
glVertex2f(this.x, this.y);
glEnd();

但不是像它应该的那样一直穿过显示器,它大约有80%的路径,并且在显示器的边缘和按钮下面有两条奇怪的线条。 Ignore the texture on top, look at the rectangle that says play

0 个答案:

没有答案