-2
백그라운드없이 스프라이트를 렌더링하는 방법은 무엇입니까? 전체 스프라이트를 렌더링 할 수 있지만 배경을 무시하고 싶습니다. 나는 경골에서 그런 종류의 렌더링을 보았 기 때문에 할 수 있음을 안다. 경골의 Sprite는 분홍색 배경으로 무시됩니다.
스프라이트 :LWJGL, Slick Util, 백그라운드없는 2 차원 렌더링 스프라이트
public class Sprite {
private Texture texture;
private float sx;
private float sy;
private String extension;
private String path;
/**
*
* @param sx
* @param sy
* @param extension
* @param path
*/
public Sprite(float sx, float sy, String extension, String path) {
this.sx = sx;
this.sy = sy;
this.extension = extension;
this.path = path;
}
public void render() {
try {
initTexture();
} catch (Exception e) {
System.out.println(e.toString());
}
Color.white.bind();
texture.bind();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(0, 1);
glVertex2f(0, texture.getTextureHeight()*2);
glTexCoord2f(1, 1);
glVertex2f(texture.getTextureWidth()*2, texture.getTextureHeight()*2);
glTexCoord2f(1, 0);
glVertex2f(texture.getTextureWidth()*2, 0);
glEnd();
}
public float getSx() {
return sx;
}
public void setSx(float sx) {
this.sx = sx;
}
public float getSy() {
return sy;
}
public void setSy(float sy) {
this.sy = sy;
}
public void initTexture() throws Exception {
texture = TextureLoader.getTexture(extension, ResourceLoader.getResourceAsStream(path));
}
}