- public Picture createPicture(int[] data, int w, int h) {
- if(w*h > data.length) throw new Error("should never happen");
- return _createPicture(data,w,h,false);
+ private static GLPicture getInnerPicture(Picture p, OpenGL gl) {
+ OpenGLPicture oglp = (OpenGLPicture)p;
+ if (!oglp.isLoaded || oglp.realPicture != null) return oglp.realPicture;
+ if (gl.rectangularTextures && p.width <= gl.maxRectTexSize && p.height <= gl.maxRectTexSize)
+ oglp.realPicture = new RectGLPicture(p.data,p.width,p.height,oglp.alphaOnly,gl);
+ else if (p.width <= gl.maxTexSize && p.height <= gl.maxTexSize)
+ oglp.realPicture = new SquareGLPicture(p.data,p.width,p.height,oglp.alphaOnly,gl);
+ else
+ oglp.realPicture = new MosaicGLPicture(p.data,p.width,p.height,oglp.alphaOnly,gl);
+ p.data = null;
+ return oglp.realPicture;