pradeepkalla
pradeepkalla

Reputation: 59

libgdx in android

I am developing a game using LibGdx, when i tried to run the game in motorola atrix which is of 2.2.2 version, it is not accepting GL10 and giving null for gl object. Can anyone help me on this.

i have my Gl related code in my render() method, what i think is, in libgdx they are using OpenGl10, but in the phones they may have a support for lower version of Gl. Am i correct in this Scenario?

Here is my code,

public class Game2D implements InputProcessor, ApplicationListener  
{  
public void create()   
{  
//initializing all   
}   
public void render() {
GL10 gl = Gdx.graphics.getGL10();
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);                           
}  
}   

the GL10 object in the code is giving null when we run in the phone, but it is running fine in the emulator..

Upvotes: 1

Views: 1031

Answers (1)

rf43
rf43

Reputation: 4405

Did you initialize it in your Android class that extends AndroidApplication?

It should look something like:

public void onCreate(final Bundle savedInstanceState) {
    super.onCreate( savedInstanceState );
    this.initialize(new Game2D, false);
}

The param "false" tells the app to use OpenGL ES 1.0 (GL10) thus:

OpenGL ES 1.0 == GL10
OpenGL ES 1.1 == GL11
OpenGL ES 2.0 == GL20

Upvotes: 5

Related Questions