gwt: allow to create empty textures..

This commit is contained in:
Hannes Janetzek 2014-03-17 00:24:46 +01:00
parent 19bd1dab9f
commit 5b58898975

View File

@ -43,14 +43,19 @@ public class GwtGLAdapter extends GwtGL20 implements GL20 {
@Override @Override
public void glTexImage2D(int target, int level, int internalformat, int width, int height, public void glTexImage2D(int target, int level, int internalformat, int width, int height,
int border, int format, int type, int border, int format, int type, Buffer pixels) {
Buffer pixels) {
if (pixels == null) {
gl.texImage2D(target, level, internalformat,
width, height, border, format,
type, null);
return;
}
Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer) pixels).get(0)); Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer) pixels).get(0));
if (pixmap != null) { if (pixmap != null) {
// Gdx.app.log("GwtGL20", "load texture "+ target + " "+ width + " " + height + " " + type + " " + format);
gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement()); gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement());
} else if (format == GL20.GL_ALPHA) { } else if (format == GL20.GL_ALPHA) {
// Gdx.app.log("GwtGL20", "load byte texture " + width + " " + height + " " + type + " " + format);
int tmp[] = new int[(width * height) >> 2]; int tmp[] = new int[(width * height) >> 2];
((IntBuffer) pixels).get(tmp); ((IntBuffer) pixels).get(tmp);