Created
August 14, 2010 04:09
-
-
Save anonymous/523955 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.demo; | |
// | |
// Demonstrates what appears to be a bug in smooth line drawing on the Android Emulator. | |
// | |
// This code works on a G1 and also JOGL on Windows, | |
// but the line widths vary depending on endpoint location on the emulator. | |
// This code will work on the emulator if line smoothing is turned off. | |
// See http://gist.github.com/523961 for the other class (the renderer) | |
import android.app.Activity; | |
import android.content.Context; | |
import android.graphics.PixelFormat; | |
import android.opengl.GLSurfaceView; | |
import android.os.Bundle; | |
import android.util.Log; | |
public class BadOglActivity extends Activity | |
{ | |
public GLSurfaceView _glSurfaceView; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
_glSurfaceView = makeGLSurfaceView(new MyCOrthoSimpleRenderer(), this); | |
setContentView(_glSurfaceView); | |
_glSurfaceView.requestRender(); | |
} | |
private GLSurfaceView makeGLSurfaceView(GLSurfaceView.Renderer renderer, Context context) { | |
GLSurfaceView view = new GLSurfaceView(context); | |
// view.setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR | GLSurfaceView.DEBUG_LOG_GL_CALLS ); | |
view.setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR ); | |
view.setEGLConfigChooser(false); | |
view.setRenderer(renderer); | |
view.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); | |
// view.getHolder().setFormat(PixelFormat.TRANSLUCENT); | |
view.getHolder().setFormat(PixelFormat.OPAQUE); | |
return view; | |
} // make gl surface view | |
//////////////////////////////////////////////// | |
// | |
// Boring Life Cycle Callbacks | |
// | |
//////////////////////////////////////////////// | |
@Override | |
protected void onRestart() { | |
super.onRestart(); | |
} | |
@Override | |
protected void onStart() { | |
super.onStart(); | |
} | |
@Override | |
protected void onResume() { | |
_glSurfaceView.requestRender(); | |
_glSurfaceView.onResume(); | |
super.onResume(); | |
} // End of onResume | |
@Override | |
protected void onPause() { | |
_glSurfaceView.onPause(); | |
super.onPause(); | |
} | |
@Override | |
protected void onStop() { | |
super.onStop(); | |
} | |
@Override | |
protected void onDestroy() { | |
super.onDestroy(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment