16
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: October 31, 2011, 02:53:49 am »
what's different between 3d model transforming and world camera transforming?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
world = new World();
world.setAmbientLight(150, 150, 150);
TextureManager.getInstance().addTexture("tris3", new Texture(BitmapFactory.decodeResource(this.getResources(), R.drawable.tris3)));
snork = Loader.loadMD2(LoadAssets.loadf("tris3.md2"), scale);
snork.setTexture("tris3");
snork.strip();
snork.build();
world.addObject(snork);
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (fb != null) {
fb = null;
}
this.width=width;
this.height=height;
fb = new FrameBuffer(gl,width, height);
}
onDrawFrame(GL10 gl) {
doAnim();
world.renderScene(fb);
world.draw(fb);
fb.display();
}
above is my key code to show texture,the md2 model loading is ok and the camera vedio as the background but the texture can't show on the model,I don't know what wrong is?if I change the OnDrawFrame(GL10 gl) function to below:OnDrawFrame(GL10 gl) {
fb=new FrameBuffer(gl, this.getWidth(),this.getHeight());
doAnim();
world.renderScene(fb);
world.draw(fb);
fb.display();
}
run above code,it can see the texure on the model but it can't show the camera as the background,the background is just black!! onDrawFrame(GL10 gl){
fb=new FrameBuffer(gl, this.getWidth(),this.getHeight);
RGBColor transp = new RGBColor(?,?,?,?);
fb.clear(transparent);
world.renderScene(fb);
world.draw(fb);
fb.display();
}
it always show black or other color background,can you tell me how to set it to be transparent?
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadMatrixf(ProjectionBuff);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadMatrixf(Transform);
I want to know how to set jpct-es like this?