import com.badlogic.gdx.graphics.glutils.ShaderProgram;\r
import com.badlogic.gdx.math.WindowedMean;\r
import com.badlogic.gdx.utils.GdxRuntimeException;\r
+import com.badlogic.gdx.utils.MathUtils;\r
\r
/**\r
* An implementation of {@link Graphics} for Android.\r
public Texture newUnmanagedTexture(int width, int height, Format format,\r
TextureFilter minFilter, TextureFilter magFilter,\r
TextureWrap uWrap, TextureWrap vWrap) {\r
- if (!isPowerOfTwo(width) || !isPowerOfTwo(height))\r
- throw new GdxRuntimeException(\r
- "Dimensions have to be a power of two");\r
+ if (gl!=gl20 && (!MathUtils.isPowerOfTwo(width) || !MathUtils.isPowerOfTwo(height)))\r
+ throw new GdxRuntimeException("Dimensions have to be a power of two");\r
\r
Bitmap.Config config = AndroidPixmap.getInternalFormat(format);\r
Bitmap bitmap = Bitmap.createBitmap(width, height, config);\r
public Texture newUnmanagedTexture(Pixmap pixmap, TextureFilter minFilter,\r
TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {\r
\r
- if (!isPowerOfTwo(pixmap.getWidth())\r
- || !isPowerOfTwo(pixmap.getHeight()))\r
- throw new GdxRuntimeException(\r
- "Dimensions have to be a power of two");\r
+ if (gl!=gl20 && (!MathUtils.isPowerOfTwo(pixmap.getWidth()) || !MathUtils.isPowerOfTwo(pixmap.getHeight())))\r
+ throw new GdxRuntimeException("Dimensions have to be a power of two");\r
\r
return new AndroidTexture(this, (Bitmap) pixmap.getNativePixmap(),\r
minFilter, magFilter, uWrap, vWrap, false, null);\r
if (image != null) {\r
this.texWidth = image.getWidth();\r
this.texHeight = image.getHeight();\r
+ \r
+ if (Gdx.gl!=Gdx.gl20 && (!MathUtils.isPowerOfTwo(image.getWidth()) || !MathUtils.isPowerOfTwo(image.getHeight())))\r
+ throw new GdxRuntimeException("texture must have power of two size");\r
}\r
\r
createTexture();\r
public Texture newUnmanagedTexture(int width, int height,\r
Pixmap.Format format, TextureFilter minFilter,\r
TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {\r
- if (!isPowerOfTwo(width) || !isPowerOfTwo(height))\r
+ if (gl!=gl20 && (!isPowerOfTwo(width) || !isPowerOfTwo(height)))\r
throw new GdxRuntimeException(\r
"Texture dimensions must be a power of two");\r
\r
@Override\r
public Texture newUnmanagedTexture(Pixmap pixmap, TextureFilter minFilter,\r
TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {\r
- if (!isPowerOfTwo(pixmap.getHeight())\r
- || !isPowerOfTwo(pixmap.getWidth()))\r
+ if (gl!=gl20 && (!isPowerOfTwo(pixmap.getWidth()) || !isPowerOfTwo(pixmap.getHeight())))\r
throw new GdxRuntimeException(\r
"Texture dimensions must be a power of two");\r
\r
public Texture newTexture(FileHandle file, TextureFilter minFilter,\r
TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {\r
Pixmap pixmap = newPixmap(file);\r
- if (!isPowerOfTwo(pixmap.getHeight())\r
- || !isPowerOfTwo(pixmap.getWidth()))\r
+ if (gl!=gl20 && (!isPowerOfTwo(pixmap.getWidth()) || !isPowerOfTwo(pixmap.getHeight())))\r
throw new GdxRuntimeException(\r
"Texture dimensions must be a power of two");\r
\r
\r
public Texture newUnmanagedTexture (int width, int height, Pixmap.Format format, TextureFilter minFilter,\r
TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {\r
- if (!MathUtils.isPowerOfTwo(width) || !MathUtils.isPowerOfTwo(height))\r
+ if (gl!=gl20 && (!MathUtils.isPowerOfTwo(height) || !MathUtils.isPowerOfTwo(height)))\r
throw new GdxRuntimeException("Texture dimensions must be a power of two: " + width + "x" + height);\r
\r
if (format == Format.Alpha)\r
\r
public Texture newUnmanagedTexture (Pixmap pixmap, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
TextureWrap vWrap) {\r
- if (!MathUtils.isPowerOfTwo(pixmap.getHeight()) || !MathUtils.isPowerOfTwo(pixmap.getWidth()))\r
+ if (gl!=gl20 && (!MathUtils.isPowerOfTwo(pixmap.getWidth()) || !MathUtils.isPowerOfTwo(pixmap.getHeight())))\r
throw new GdxRuntimeException("Texture dimensions must be a power of two: " + width + "x" + height);\r
\r
return new LwjglTexture((BufferedImage)pixmap.getNativePixmap(), minFilter, magFilter, uWrap, vWrap, false);\r
TextureWrap vWrap) {\r
if (enforcePotImages) {\r
Pixmap pixmap = newPixmap(file);\r
- if (!MathUtils.isPowerOfTwo(pixmap.getHeight()) || !MathUtils.isPowerOfTwo(pixmap.getWidth()))\r
+ if (gl!=gl20 && (!MathUtils.isPowerOfTwo(pixmap.getWidth()) || !MathUtils.isPowerOfTwo(pixmap.getHeight())))\r
throw new GdxRuntimeException("Texture dimensions must be a power of two: " + file + " (" + pixmap.getWidth() + "x"\r
+ pixmap.getHeight() + ")");\r
}\r
public Texture newUnmanagedTexture(int width, int height, Format format,\r
TextureFilter minFilter, TextureFilter magFilter,\r
TextureWrap uWrap, TextureWrap vWrap) {\r
- if (!MathUtils.isPowerOfTwo(width) || !MathUtils.isPowerOfTwo(height))\r
- throw new GdxRuntimeException(\r
- "Texture dimensions must be a power of two: " + width + "x"\r
- + height);\r
\r
if (format == Format.Alpha)\r
return new AngleTexture(width, height,\r
\r
@Override\r
public Texture newUnmanagedTexture(Pixmap pixmap, TextureFilter minFilter,\r
- TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {\r
- if (!MathUtils.isPowerOfTwo(pixmap.getHeight())\r
- || !MathUtils.isPowerOfTwo(pixmap.getWidth()))\r
- throw new GdxRuntimeException(\r
- "Texture dimensions must be a power of two: " + width + "x"\r
- + height);\r
+ TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) { \r
\r
return new AngleTexture((BufferedImage) pixmap.getNativePixmap(),\r
minFilter, magFilter, uWrap, vWrap, false);\r
@Override\r
public Texture newTexture(FileHandle file, TextureFilter minFilter,\r
TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) { \r
- Pixmap pixmap = newPixmap(file);\r
- if (!MathUtils.isPowerOfTwo(pixmap.getHeight()) || !MathUtils.isPowerOfTwo(pixmap.getWidth()))\r
- throw new GdxRuntimeException("Texture dimensions must be a power of two: " + file + " (" + pixmap.getWidth() + "x"\r
- + pixmap.getHeight() + ")"); \r
-\r
+ \r
return new AngleTexture(file, minFilter, magFilter, uWrap, vWrap, false);\r
}\r
\r