1
Support / Hlep about two Renderer or two GLSurfaceView
« on: November 25, 2011, 10:15:50 am »Code: [Select]
package sim.feel;
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Interact2D;
import com.threed.jpct.Object3D;
import com.threed.jpct.SimpleVector;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class mainact extends Activity {
// GLSurfaceView
GLSurfaceView glView;
// GLSurfaceView glView0;
int V_state;
//
yjmr mr = new yjmr(this);
welview wv=new welview(this);
//-
fthread ft = new fthread();
//P_Thread pt =new P_Thread(this,mr);
DisplayMetrics dm;
float camera_hts=130f;
int z=0;
int xpos;
int ypos;
SimpleVector dir1;
int td1=0;
int w_ws;
int w_hs;
//-
//flower 1
boolean start=false;
//flower 2
//-menu
public static final int ITEM0=Menu.FIRST;//
public static final int ITEM1=Menu.FIRST+1;
//-menu 2
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//
requestWindowFeature(Window.FEATURE_NO_TITLE);
//
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//
//1
dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
w_ws=dm.widthPixels;
w_hs=dm.heightPixels;
//2
new LoadFile(getResources());
glView = new GLSurfaceView(this);
glView.setRenderer(wv);
// glView0 = new GLSurfaceView(this);
// glView0.setRenderer(mr);
setContentView(glView);
V_state=0;
}
public boolean onTouchEvent(MotionEvent me) {
if (me.getAction() == MotionEvent.ACTION_DOWN) {
// start=true;
xpos=(int)me.getX();
ypos=(int)me.getY();
//ft.start();
switch(V_state){
case 0:
Object3D p_obj0=leiheji.selpj(xpos, ypos, wv.world, wv.fb);
if(p_obj0==wv.anniu[0]){
glView = new GLSurfaceView(this);
glView.setRenderer(mr);
glView.requestRender();
// glView0 = new GLSurfaceView(this);
// glView0.setRenderer(mr);
setContentView(glView);
wv.fb.dispose();
}
Hallo everyone
I have problem about this , from one GLSurfaceView(or Renderer) switch to another GLSurfaceView(or Renderer) .
maybe like above code ,but that is can't work.
Are there some example or some can help ? Think you every much !!!