Membuat Polygon/Segibanyak

2.5 Membuat Polygon/Segibanyak

Polygon adalah bangun dua dimensi yang memiliki sejumlah si- si dan sudut. Segitiga merupakan bentuk polygon dengan tiga sisi dan sudut. Segiempat merupakan bentuk polygon dengan empat sisi dan empat sudut. Segilima (pentagon) merupakan bentuk polygon dengan lima sisi dan sudut. Segienam (hexagon) merupakan bentuk polygon dengan enam sisi dan sudut. Dan Polygon dengan sisi terbanyak adaalah bangun lingkaran. Berikut adalah potongan script untuk membuat pentagon,

“public void draw_polygon3(GL10 gl, boolean myGL_Wire){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // set the global colour for the triangle gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, makeFloatBuffer(vertices_poly3)); if(myGL_Wire==false) {

// Draw the vertices as polygon gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, vertices_poly3.length/3);

}else {

// set the global colour for wire the triangle gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, vertices_poly3.length / 3);

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); }”

Gambar 2.13 Wired-Flat-Color Segilima (Pentagon) Pada Gambar 2.14, objek-objek tersebut merupakan hasil run-

ning kode program di file “ESRender.java” yaitu “polygonObject.draw_polygon3_multi_color(gl,true); .. polygonObject.draw_polygon3(gl,false); .. polygonObject.draw_polygon3_multi_color(gl,false);” Jika parameter ke-2 dalam setiap kode program di atas bernilai

“true”, maka wire (garis tepian) dari objek akan nampak, tetapi jika “false” maka akan nampak warna dari keseluruhan pada permukaan objek, baik satu warna maupun beberapa warna disetiap vertex atau sudut objek.

Gambar 2.14 Polygon statis dan dinamis (n-sisi) Source Code 2.8 Membuat Polygon Statis dan Dinamis

ESRender.java

package com.example.imacho.createpolygon;

import android.opengl.GLSurfaceView.Renderer; import android.opengl.GLU; import android.os.SystemClock;

import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10;

/** * Created by Imacho on 4/5/2015. */

public class ESRender implements Renderer {

private PolygonObject polygonObject; // the ob- ject to be drawn private long prevtime = SystemClock.uptimeMillis(); private int sisi = 3; private int runMode=1;

/** Constructor to set the handed over context */ public ESRender() {

this.polygonObject = new PolygonObject();

@Override public void onDrawFrame(GL10 gl) {

gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // set background with white color //gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // set background with black color

gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); // clear Screen and Depth

Buffer

// display drawing polygon wire gl.glPushMatrix();

// start freeze state/event to each object gl.glTranslatef(-3.5f, -1.0f, -7.0f); polygonObject.draw_polygon3(gl, true);

gl.glPopMatrix(); // end freeze state/event to each object

// display drawing polygon wire color gl.glPushMatrix();

// start freeze state/event to each object gl.glTranslatef(-1.2f, -1.0f, -7.0f); polygonOb-

ject.draw_polygon3_multi_color(gl,true); gl.glPopMatrix(); // end freeze state/event to each object

// display drawing polygon flat gl.glPushMatrix();

// start freeze state/event to each object gl.glTranslatef(1.2f, -1.0f, -7.0f); polygonObject.draw_polygon3(gl, false);

gl.glPopMatrix(); // end freeze state/event to each object

// display drawing polygon color gl.glPushMatrix();

// start freeze state/event to each object gl.glTranslatef(3.5f, -1.0f, -7.0f); polygonObject.draw_polygon3_multi_color(gl,

false); gl.glPopMatrix(); // end freeze state/event to each object

// display drawing polygon dinamis wire gl.glPushMatrix();

// start freeze state/event to each object gl.glTranslatef(-3.5f, 1.0f, -7.0f); polygonObject.draw_polygon_dinamis(gl, 10,

true); gl.glPopMatrix(); // end freeze state/event to each object

// display drawing polygon dinamis wire color gl.glPushMatrix();

// start freeze state/event to each object gl.glTranslatef(-1.2f, 1.0f, -7.0f); polygonOb-

ject.draw_polygon_dinamis_multi_color(gl, 10, true); gl.glPopMatrix(); // end freeze state/event to each object

// display drawing polygon dinamis flat gl.glPushMatrix();

// start freeze // start freeze

false); gl.glPopMatrix(); // end freeze state/event to each object

// display drawing polygon dinamis color long curtime = SystemClock.uptimeMillis(); if ((curtime - prevtime) > 2000) {

prevtime = curtime; if (runMode==1) {

sisi += 1; if (sisi > 20) {

runMode=0; } } else{

sisi -= 1; if (sisi == 3) {

runMode=1; } } } gl.glPushMatrix();

// start freeze state/event to each object gl.glTranslatef(3.5f, 1.0f, -7.0f); polygonOb-

ject.draw_polygon_dinamis_multi_color(gl, sisi, false); gl.glPopMatrix(); // end freeze state/event to each object

@Override public void onSurfaceChanged(GL10 gl, int width, int

height) { if (height == 0) height = 1; // To prevent divide by zero float aspect = (float) width / height; // Set the viewport (display area) to cover the

entire window gl.glViewport(0, 0, width, height); // Setup perspective projection, with aspect ra-

tio matches viewport gl.glMatrixMode(GL10.GL_PROJECTION); // Select projection matrix gl.glLoadIdentity(); // Reset projection matrix // Use perspective projection GLU.gluPerspective(gl, 45, aspect, 0.1f, 100.f); gl.glMatrixMode(GL10.GL_MODELVIEW); // Select

model-view matrix gl.glLoadIdentity(); // Reset }

@Override @Override

MainActivity.java

package com.example.imacho.createpolygon; import android.app.Activity; import android.opengl.GLSurfaceView; import android.os.Bundle; import android.view.Menu; import android.view.Window; import android.view.WindowManager;

public class MainActivity extends Activity { /** The OpenGL view */ private GLSurfaceView glSurfaceView;

@Override protected void onCreate(Bundle savedInstanceS-

tate) { super.onCreate(savedInstanceState); // requesting to turn the title OFF

requestWindowFea- ture(Window.FEATURE_NO_TITLE);

// making it full screen getWin- dow().setFlags(WindowManager.LayoutParams.FLAG_FULLSC REEN,

WindowManag- er.LayoutParams.FLAG_FULLSCREEN);

// Initiate the Open GL view and create an instance with this activity glSurfaceView = new GLSurfaceView(this);

// set our renderer to be the main renderer with the current activity context glSurfaceView.setRenderer(new ESRender()); setContentView(glSurfaceView);

/** * Remember to resume the glSurface */

@Override protected void onResume() {

super.onResume(); glSurfaceView.onResume();

/** * Also pause the glSurface

*/ @Override protected void onPause() {

super.onPause(); glSurfaceView.onPause();

@Override public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present. getMenuInflat- er().inflate(R.menu.menu_main, menu); return true; } }

PolygonObject.java

package com.example.imacho.createpolygon;

import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.ShortBuffer; import javax.microedition.khronos.opengles.GL10;

/** * Created by Imacho on 4/5/2015. */

public class PolygonObject { private float vertices_poly_dinamis[]=null; private float color_poly_dinamis[]=null;

private float[] vertices_poly1 = { -1.0f, -1.0f, 0.0f, // V1 - first vertex (x,y,z) 1.0f, -1.0f, 0.0f,

// V2 - second ver- tex 0.0f, 1.0f, 0.0f // V3 - third vertex (x,y,z) };

private float[] vertices_poly2 = { -1.0f, -1.0f, 0.0f, // V1 - first vertex (x,y,z) 1.0f, -1.0f, 0.0f,

// V2 - second ver- tex 2.0f, 1.0f, 0.0f,

// V3 - third ver- tex (x,y,z) 0.0f, 1.0f, 0.0f // V4 };

private float[] color_poly2 = { // Vertices for col- or 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f

private float[] vertices_poly3 = { -1.0f, -1.0f, 0.0f, // V1 - first vertex (x,y,z) 1.0f, -1.0f, 0.0f,

// V2 - second ver- tex 1.0f, 0.0f, 0.0f,

// V3 - third ver- tex (x,y,z) 0.0f, 1.0f, 0.0f,

// V4 -1.0f, 0.0f, 0.0f

// V5 };

private float[] color_poly3 = { // Vertices for col- or 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.5f, 0.0f, 0.0f, 1.0f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.5f

public PolygonObject() { }

// Point to our vertex buffer, return buffer holding the vertices

// a float is 4 bytes, therefore we multiply the number if // vertices with 4. public static FloatBuffer makeFloatBuffer(float[]

arr) { ByteBuffer bb = ByteBuff- er.allocateDirect(arr.length * 4); bb.order(ByteOrder.nativeOrder()); FloatBuffer fb = bb.asFloatBuffer(); fb.put(arr); fb.position(0); return fb;

public float[] getAngleArrays(int sides) {

float[] angleArray = new float[sides]; float commonAngle = 360.0f/sides; float halfAngle = commonAngle/2.0f; float firstAngle = 360.0f - (90+halfAngle); angleArray[0] = firstAngle;

float curAngle = firstAngle; for(int i=1;i<sides;i++) {

float newAngle = curAngle - commonAngle; angleArray[i] = newAngle; curAngle = newAngle;

} //printArray(angleArray, "angleArray"); return angleArray; } //printArray(angleArray, "angleArray"); return angleArray;

if (Math.abs(f) < 0.001) {

return 0; } return f;

public float[] rotasi_titik2D(float titik_pusat_x, float titik_pusat_y, float jari_jari, float nilai_sudut) {

// Titik Pusat dan titik awal float a = titik_pusat_x; float b = titik_pusat_y; float x = a + jari_jari; float y = b;

float[] vertices_rotate = new float[3]; vertices_rotate[0] = (float) ((x - a)

* getApprox- Value((float)Math.cos(Math.toRadians(nilai_sudut)))

- ((y - b) * getApprox-

Value((float)Math.sin(Math.toRadians(nilai_sudut)))) + a);

vertices_rotate[1] = (float) ((x - a) * getApprox- Value((float)Math.sin(Math.toRadians(nilai_sudut)))

- ((y - b) * getApprox-

Value((float)Math.cos(Math.toRadians(nilai_sudut)))) + b);

vertices_rotate[2] = 0;

return vertices_rotate; }

// short is 2 bytes, therefore we multiply the num- ber if // vertices with 2. public static ShortBuffer makeShortBuffer(short[]

arr) { ByteBuffer bb = ByteBuff- er.allocateDirect(arr.length * 2); bb.order(ByteOrder.nativeOrder()); ShortBuffer sb = bb.asShortBuffer(); sb.put(arr); sb.position(0); return sb;

/** The draw method for the primitive object with the GL context */ public void draw_polygon(GL10 gl){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

// set the global colour for the triangle gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// Point to our vertex buffer /*gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(new float [] { -1.0f, -1.0f, 0.0f, // V1 - first ver- tex (x,y,z) 1.0f, -1.0f, 0.0f, // V2 - second ver- tex 0.0f, 1.0f, 0.0f

// V3 - third ver- tex (x,y,z) }));*/ gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(vertices_poly1));

// Draw the vertices as polygon gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, verti-

ces_poly1.length/3);

// set the global colour for wire the triangle gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon //gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, verti-

ces_poly1.length/3);

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

public void draw_polygon2(GL10 gl, boolean myGL_Wire){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

// set the global colour for the triangle gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// Point to our vertex buffer /*gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(new float [] { -1.0f, -1.0f, 0.0f, // V1 - first ver- tex (x,y,z) 1.0f, -1.0f, 0.0f, // V2 - second ver- tex 2.0f, 1.0f, 0.0f,

// V3 - third ver- tex (x,y,z) 0.0f, 1.0f, 0.0f

// V3 - third ver- tex (x,y,z) }));*/ gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(vertices_poly2));

// Draw the vertices as polygon //gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, ver-

tices_poly2.length/3);

// set the global colour for wire the polygon gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon // Draw the wire as edge polygon

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

public void draw_polygon2_multi_color(GL10 gl, bool- ean myGL_Wire){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

// set the global colour for the triangle gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// Point to our vertex buffer /*gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(new float [] { -1.0f, -1.0f, 0.0f, // V1 - first ver- tex (x,y,z) 1.0f, -1.0f, 0.0f, // V2 - second ver- tex 2.0f, 1.0f, 0.0f,

// V3 - third ver- tex (x,y,z) 0.0f, 1.0f, 0.0f

// V3 - third ver- tex (x,y,z) }));*/ gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(vertices_poly2)); gl.glColorPointer(4,GL10.GL_FLOAT,0, makeFloat- Buffer(color_poly2));

if(myGL_Wire==false) {

// Draw the vertices as polygon gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0,

vertices_poly2.length/3); }else { // set the global colour for wire the poly- gon gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, verti-

ces_poly2.length / 3); }

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY);

public void draw_polygon3(GL10 gl, boolean myGL_Wire){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

// set the global colour for the triangle gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// Point to our vertex buffer

/*gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make- FloatBuffer(new float [] { -1.0f, -1.0f, 0.0f, // V1 - first ver- tex (x,y,z) 1.0f, -1.0f, 0.0f, // V2 - second ver- tex 1.0f, 0.0f, 0.0f,

// V3 - third ver- tex (x,y,z) 0.0f, 1.0f, 0.0f,

// V3 - third ver- tex (x,y,z) -1.0f, 0.0f, 0.0f

// V3 - third ver- tex (x,y,z) }));*/ gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(vertices_poly3));

if(myGL_Wire==false) {

// Draw the vertices as polygon gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0,

vertices_poly3.length/3); }else { // set the global colour for wire the trian- gle gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, verti-

ces_poly3.length / 3); }

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

public void draw_polygon3_multi_color(GL10 gl, bool- ean myGL_Wire){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

// set the global colour for the triangle gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// Point to our vertex buffer /*gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(new float [] { -1.0f, -1.0f, 0.0f, // V1 - first ver- tex (x,y,z) 1.0f, -1.0f, 0.0f, // V2 - second ver- tex 1.0f, 0.0f, 0.0f,

// V3 - third ver- tex (x,y,z) 0.0f, 1.0f, 0.0f,

// V3 - third ver- tex (x,y,z) -1.0f, 0.0f, 0.0f

// V3 - third ver- tex (x,y,z) }));*/ gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(vertices_poly3)); gl.glColorPointer(4,GL10.GL_FLOAT,0, makeFloat-

Buffer(color_poly3));

if(myGL_Wire==false) {

// Draw the vertices as polygon gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0,

vertices_poly3.length/3); }else { // set the global colour for wire the trian- gle gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, verti-

ces_poly3.length / 3); }

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY);

public void draw_polygon_dinamis(GL10 gl, int sisi, boolean myGL_Wire){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

// set the global colour for the polygon dinamis gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// get sudut polygon dengan sides=sisi float [] ArraySudut=new float[sisi]; ArraySudut=getAngleArrays(sisi);

// init nilai x,y,z float [] ArrayNilaiXYZ=new float[sisi];

float sudutTemp; int loop=0;

// set ukuran dari vertices_poly_dinamis = new float[sisi * 3]; vertices_poly_dinamis = new float[sisi * 3]; for(int i=1;i<=sisi;i++){

// get sudut ke-i sudutTemp=ArraySudut[i-1];

// transformasi titik ArrayNilaiXYZ=rotasi_titik2D(0.0f, 0.0f,

1.0f, sudutTemp);

verti- ces_poly_dinamis[loop]=ArrayNilaiXYZ[0]; verti- ces_poly_dinamis[loop+1]=ArrayNilaiXYZ[1]; verti- ces_poly_dinamis[loop+2]=ArrayNilaiXYZ[2]; loop+=3; }

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make-

FloatBuffer(vertices_poly_dinamis));

if(myGL_Wire==false) {

// Draw the vertices as polygon gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0,

vertices_poly_dinamis.length/3); }else { // set the global colour for wire the poly- gon dinamis gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, verti-

ces_poly_dinamis.length / 3); }

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

public void draw_polygon_dinamis_multi_color(GL10 gl, int sisi, boolean myGL_Wire){ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

// set the global colour for the polygon dinamis //gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

// init titik pusat dan jari-jari float titik_pusat_x=0.0f; float titik_pusat_y=0.0f; float jari_jari=1.0f;

// get sudut polygon dengan sides=sisi float [] ArraySudut=new float[sisi]; ArraySudut=getAngleArrays(sisi);

// init nilai x,y,z float [] ArrayNilaiXYZ=new float[sisi];

float sudutTemp; int loop=0; int loop_color=0;

// set ukuran dari vertices_poly_dinamis = new float[sisi * 3]; vertices_poly_dinamis = new float[sisi * 3];

// set ukuran dari color_poly_dinamis = new float[sisi * 4];

color_poly_dinamis = new float[sisi * 4]; for(int i=1;i<=sisi;i++){

// get sudut ke-i sudutTemp=ArraySudut[i-1];

// transformasi titik ArrayNilaiXYZ=rotasi_titik2D(titik_pusat_x,

titik_pusat_y, jari_jari, sudutTemp);

// set nilai x, y, z dari polygon verti-

ces_poly_dinamis[loop]=ArrayNilaiXYZ[0]; verti- ces_poly_dinamis[loop+1]=ArrayNilaiXYZ[1]; verti- ces_poly_dinamis[loop+2]=ArrayNilaiXYZ[2]; loop+=3;

// set nilai warna setiap vertex (x,y,z) --> (r,g,b,a) float a = titik_pusat_x; float b = titik_pusat_y; float x = a + jari_jari; float y = b; color_poly_dinamis[loop_color] = (float) ((x

- a) * Math.cos(Math.toRadians(sudutTemp)) - ((y - b) * Math.sin(Math.toRadians(sudutTemp))) + a); color_poly_dinamis[loop_color + 1] = (float) ((x - a) * Math.sin(Math.toRadians(sudutTemp)) - ((y - b) * Math.cos(Math.toRadians(sudutTemp))) + b); color_poly_dinamis[loop_color + 2] = 0.5f; color_poly_dinamis[loop_color + 3] = 0.5f; loop_color += 4;

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, make- FloatBuffer(vertices_poly_dinamis)); gl.glColorPointer(4,GL10.GL_FLOAT,0, makeFloat- Buffer(color_poly_dinamis));

if(myGL_Wire==false) {

// Draw the vertices as polygon gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0,

vertices_poly_dinamis.length/3); }else { // set the global colour for wire the poly- gon dinamis //gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

// Draw the wire as edge polygon gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, verti-

ces_poly_dinamis.length / 3); }

//Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY);

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/androi d"

package="com.example.imacho.createpolygon" > <application

android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity

android:name=".MainActivity" android:label="@string/app_name" an-

droid:screenOrientation="landscape" an- droid:configChanges="orientation|screenSize" > <intent-filter> <action an- droid:name="android.intent.action.MAIN" />

<category an- droid:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>