Skip to content

Instantly share code, notes, and snippets.

View misdake's full-sized avatar

misdake misdake

  • Shanghai
  • 18:45 (UTC +08:00)
  • X @rSkip
View GitHub Profile
@misdake
misdake / GLTextureView.java
Created October 22, 2015 03:42 — forked from eleventigers/GLTextureView.java
GLTextureView from GLSurfaceView
import java.io.Writer;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGL11;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL;
@misdake
misdake / OpenglActivity.java
Created July 24, 2013 05:37
Activity "keep screen on" & "full screen, landscape"
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
//Full screen, landscape.
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
@misdake
misdake / OpenglUtil.java
Created July 24, 2013 02:50
Android get resourceId from fileName
public static int getResourceId(Context context, String name) {
name = name.toLowerCase();
return context.getResources().getIdentifier(name, "drawable", context.getPackageName());
}
@misdake
misdake / MapPanel3D.java
Created July 11, 2013 10:21
JOGL create view.
setLayout(new BorderLayout(0, 0));
final GLCanvas canvas = new GLCanvas();
canvas.setMinimumSize(new Dimension()); //fix a GLCanvas resize bug.
animator = new Animator(canvas); //TODO switch to FPSAnimator to save energy.
canvas.addGLEventListener(OpenglCore.getInstance());
this.add(canvas);