thank .
Now fixed the issue .
Now fixed the issue .
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.
Show posts Menu
world = new World();
world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
// Create a texture out of the icon...:-)
TextureManager txtMgr = TextureManager.getInstance();
if (!txtMgr.containsTexture("texture")) {
Texture texture = new Texture(BitmapHelper.rescale(
BitmapHelper.convert(mActivity.getResources().getDrawable(R.drawable.cosmic_pic_05)), 64, 64));
txtMgr.addTexture("texture", texture);
}
tm = TextureManager.getInstance();
cube=loadOBJModel();
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.strip();
cube.build();
//cube.rotateY(-180);
//cube.rotateX(90);
world.addObject(cube);
cam = world.getCamera();
SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
//sv.x += 500;
sv.y += 5000;
sv.z += 1000;
sun.setPosition(sv);
MemoryHelper.compact();
}
private Object3D loadOBJModel() {
Object3D[] model = null;
model = Loader.loadOBJ(mActivity.getResources().openRawResource(R.raw.chinies_obj),
mActivity.getResources().openRawResource(R.raw.chinies_mtl), 1.0f);
return Object3D.mergeAll(model);
}
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{
DebugLog.LOGD("GLRenderer::onSurfaceCreated");
// Call native function to initialize rendering:
initRendering();
// Call Vuforia function to (re)initialize rendering after first use
// or after OpenGL ES context was lost (e.g. after onPause/onResume):
QCAR.onSurfaceCreated();
}
public void onSurfaceChanged(GL10 gl, int width, int height)
{
DebugLog.LOGD(String.format("GLRenderer::onSurfaceChanged (%d, %d)", width, height));
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(width, height);
Config.viewportOffsetAffectsRenderTarget=true;
// Call native function to update rendering when render surface
// parameters have changed:
System.out.println("11111111111111111111");
updateRendering(width, height);
// Call Vuforia function to handle render surface size changes:
QCAR.onSurfaceChanged(width, height);
}
public void onDrawFrame(GL10 gl)
{
if (!mIsActive)
return;
/* if(cube!=null)
{
cube.animate(anim, 0);
if (anim>1) {
anim=0;
} else {
anim+=0.01f;
}
}*/
// Update render view (projection matrix and viewport) if needed:
mActivity.updateRenderView();
updateCamera();
// Call our native function to render content
renderFrame();
world.renderScene(fb);
world.draw(fb);
fb.display();
}
public void updateModelviewMatrix(float mat[]) {
modelViewMat = mat;
}
public void updateCamera() {
if (modelViewMat != null) {
float[] m = modelViewMat;
final SimpleVector camUp;
if (mActivity.isPortrait()) {
camUp = new SimpleVector(-m[0], -m[1], -m[2]);
} else {
camUp = new SimpleVector(-m[4], -m[5], -m[6]);
}
final SimpleVector camDirection = new SimpleVector(m[8], m[9], m[10]);
final SimpleVector camPosition = new SimpleVector(m[12], m[13], m[14]);
cam.setOrientation(camDirection, camUp);
cam.setPosition(camPosition);
cam.setFOV(fov);
cam.setYFOV(fovy);
}
}
Page created in 0.054 seconds with 13 queries.