My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.badlogic.gamedev.samples;

import javax.microedition.khronos.opengles.GL10;

import android.opengl.GLU;
import android.os.Bundle;

import com.badlogic.gamedev.tools.GameActivity;
import com.badlogic.gamedev.tools.GameListener;
import com.badlogic.gamedev.tools.Mesh;
import com.badlogic.gamedev.tools.Mesh.PrimitiveType;

public class OrthoSample extends GameActivity implements GameListener
{
Mesh mesh;

public void onCreate( Bundle bundle )
{
super.onCreate( bundle );
setGameListener( this );
}

@Override
public void setup(GameActivity activity, GL10 gl)
{
mesh = new Mesh( gl, 3, false, false, false );
mesh.vertex( 0, 0, 0 );
mesh.vertex( 50, 0, 0 );
mesh.vertex( 25, 50, 0 );
}

@Override
public void mainLoopIteration(GameActivity activity, GL10 gl)
{
gl.glViewport( 0, 0, activity.getViewportWidth(), activity.getViewportHeight() );
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluOrtho2D(gl, 0, activity.getViewportWidth(), 0, activity.getViewportHeight() );

mesh.render(PrimitiveType.Triangles);
}
}

Change log

r70 by quantumgame on Mar 10, 2011   Diff
[fixed] a couple of missing glClears...
Go to: 
Project members, sign in to write a code review

Older revisions

r19 by quantumgame on Jan 8, 2010   Diff
[No log message]
All revisions of this file

File info

Size: 1175 bytes, 44 lines
Powered by Google Project Hosting