* An implementation of the {@link Graphics} interface based on Lwjgl.\r
* @author mzechner\r
*/\r
-final class LwjglGraphics implements Graphics {\r
+public final class LwjglGraphics implements Graphics {\r
GLCommon gl;\r
GL10 gl10;\r
GL11 gl11;\r
int height;\r
String title;\r
Canvas canvas;\r
+ boolean enforcePotImages = true;\r
\r
LwjglGraphics (String title, int width, int height, boolean useGL2IfAvailable) {\r
useGL2 = useGL2IfAvailable;\r
\r
public Texture newTexture (FileHandle file, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
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
+ if (enforcePotImages) {\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 LwjglTexture(file, minFilter, magFilter, uWrap, vWrap, false);\r
}\r
public float getPpcY() {\r
return (Toolkit.getDefaultToolkit().getScreenResolution() / 2.54f);\r
}\r
+\r
+ public void setEnforcePotImages (boolean enforcePotImages) {\r
+ this.enforcePotImages = enforcePotImages;\r
+ }\r
}\r
import com.badlogic.gdx.Gdx;\r
import com.badlogic.gdx.InputProcessor;\r
import com.badlogic.gdx.backends.lwjgl.LwjglCanvas;\r
+import com.badlogic.gdx.backends.lwjgl.LwjglGraphics;\r
import com.badlogic.gdx.files.FileHandle;\r
import com.badlogic.gdx.graphics.BitmapFont;\r
import com.badlogic.gdx.graphics.Color;\r
\r
public void create () {\r
if (spriteBatch != null) return;\r
+\r
+ ((LwjglGraphics)Gdx.graphics).setEnforcePotImages(false);\r
+\r
spriteBatch = new SpriteBatch();\r
\r
font = new BitmapFont(Gdx.files.getFileHandle("data/default.fnt", FileType.Internal), Gdx.files.getFileHandle(\r