OSDN Git Service

[added] GLU interface with the set of methods provided in android. Implemented for...
[mikumikustudio/libgdx-mikumikustudio.git] / tests / gdx-tests / src / com / badlogic / gdx / tests / IsoCamTest.java
diff --git a/tests/gdx-tests/src/com/badlogic/gdx/tests/IsoCamTest.java b/tests/gdx-tests/src/com/badlogic/gdx/tests/IsoCamTest.java
new file mode 100644 (file)
index 0000000..ad36093
--- /dev/null
@@ -0,0 +1,49 @@
+package com.badlogic.gdx.tests;\r
+\r
+import com.badlogic.gdx.Gdx;\r
+import com.badlogic.gdx.graphics.GL10;\r
+import com.badlogic.gdx.graphics.Mesh;\r
+import com.badlogic.gdx.graphics.Texture;\r
+import com.badlogic.gdx.graphics.VertexAttribute;\r
+import com.badlogic.gdx.graphics.VertexAttributes.Usage;\r
+import com.badlogic.gdx.math.Matrix4;\r
+import com.badlogic.gdx.math.Vector3;\r
+import com.badlogic.gdx.tests.utils.GdxTest;\r
+\r
+public class IsoCamTest extends GdxTest {\r
+\r
+       @Override public boolean needsGL20 () {\r
+               return false;\r
+       }\r
+\r
+       Texture texture;\r
+       Mesh mesh;\r
+       Matrix4 projection;\r
+       Matrix4 view;\r
+       \r
+       @Override public void create() {\r
+               mesh = new Mesh(true, 4, 6, new VertexAttribute(Usage.Position, 3, "a_pos"));\r
+               mesh.setVertices(new float[] {\r
+                       -1, 0,  1,\r
+                        1, 0,  1,\r
+                        1, 0, -1,\r
+                       -1, 0, -1\r
+               });\r
+               mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 });\r
+               \r
+               projection = new Matrix4();\r
+               projection.setToOrtho(-5, 5, -5, 5, -1, -100);\r
+               view = new Matrix4();\r
+               view.setToLookAt(new Vector3(3, 3, 3), new Vector3(0,0,0), new Vector3(0, 1, 0));\r
+       }\r
+       \r
+       @Override public void render() {\r
+               Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r
+               Gdx.gl10.glMatrixMode(GL10.GL_PROJECTION);\r
+               Gdx.gl10.glLoadMatrixf(projection.val, 0);\r
+               Gdx.gl10.glMatrixMode(GL10.GL_MODELVIEW);\r
+               Gdx.gl10.glLoadMatrixf(view.val, 0);\r
+               \r
+               mesh.render(GL10.GL_TRIANGLES);\r
+       }\r
+}\r