我已将大部分内容配置为光滑教程的字母,但我得到的是左下角的png仅填充四分之三的四边形,四边形的尺寸为100x100,纹理是填充它完全,但由于某种原因,我不能包装工作(帮助!!如果这是我的错误)
注册码:
public Form(String fileName, Frame frame) {
try {
texture = TextureLoader.getTexture(
"PNG",
ResourceLoader.getResourceAsStream("img/" + fileName
+ ".png"));
} catch (IOException e) {
e.printStackTrace();
}
this.frame = frame;
VectorFrame = a.constructVectorFrame(frame);
}
渲染代码:
GL11.glEnable(GL11.GL_TEXTURE_2D);
Color.white.bind();
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2d(point.x, point.y);
GL11.glTexCoord2f(0, 1);
GL11.glVertex2d(point.x, point.y + frame.maxY);
GL11.glTexCoord2f(1, 1);
GL11.glVertex2d(point.x + frame.maxX, point.y + frame.maxY);
GL11.glTexCoord2f(1, 0);
GL11.glVertex2d(point.x + frame.maxX, point.y);
GL11.glEnd();
GL11.glDisable(GL11.GL_TEXTURE_2D);
a.renderVectorFrame(point, VectorFrame);
答案 0 :(得分:1)
光滑迫使你使用2次幂纹理。您有两种方法可以解决这个问题:
另外,请看这个问题:Texture doesn't stretch properly. Why is this happening?