Show Posts

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.


Messages - Anton

Pages: [1]
1
Support / Re: ELLIPSOID_ALIGNED vs ELLIPSOID_TRANSFORMED
« on: June 05, 2015, 11:25:05 am »
Egon, thanks for prompt response.
Now everything is clear.

2
Support / ELLIPSOID_ALIGNED vs ELLIPSOID_TRANSFORMED
« on: June 05, 2015, 09:37:50 am »
Can some explain what the difference between this options? Because the documentation is not clear how the ellipse will be transformed when performing collision detection with ELLIPSOID_TRANSFORMED options.

3
Support / Re: Loading obj model OK but not displayed
« on: May 27, 2015, 09:52:33 pm »
Thanks a lot.
I will continue to learn the basics.

4
Support / Re: Loading obj model OK but not displayed
« on: May 27, 2015, 05:20:26 pm »
If I understand correctly this code translate model to the origin and set rotation pivot and center to the origin. Is it right? And then I must scale model as I need?

Code: [Select]
InputStream objStream = mContext.getResources().openRawResource(R.raw.test_obj);
Object3D[] loadRes = Loader.loadOBJ(objStream, null, 1);

cube = loadRes[0];

float[] bb = cube.getMesh().getBoundingBox();
cube.translate(-(bb[0] + ((bb[1] - bb[0]) / 2)),
-(bb[2] + ((bb[3] - bb[2]) / 2)), -(bb[4] + ((bb[5] - bb[4]) / 2)));
cube.translateMesh();
cube.setTranslationMatrix(new Matrix());

cube.build();

cube.setCenter(SimpleVector.ORIGIN);
cube.setRotationPivot(SimpleVector.ORIGIN);

cube.scale(0.05f);

world.addObject(cube);

5
Support / Re: Loading obj model OK but not displayed
« on: May 27, 2015, 02:09:28 pm »
Egon, thank you very much.
By selecting I found the correct scale. When I load model it is 0.001f and after build I scale it with parameter 20.
But it is not clear if I load model with 0.02f scale and after build I do not scale I do not see it again.
What different between this approaches?

6
Support / Re: Loading obj model OK but not displayed
« on: May 25, 2015, 09:41:26 am »
Egon, thank you for reply.
I am trying to scale, translate the object but still I do not see it. I'm a newbie in 3D programming and probably not fully understand all the methods of working with 3D objects.
Can you help me to determine what kind of transformation I must do that the object became visible.

7
Support / Loading obj model OK but not displayed
« on: May 22, 2015, 05:36:00 pm »
Hi all. I have some problem with displaying obj model.
Here code of my renderer class:
Code: [Select]
package com.amulet_it.openglexample;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.content.Context;
import android.graphics.Color;
import android.graphics.PointF;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.widget.Toast;

import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Interact2D;
import com.threed.jpct.Light;
import com.threed.jpct.Loader;
import com.threed.jpct.Matrix;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;

import java.io.InputStream;
import java.util.HashMap;

public class MyRenderer implements GLSurfaceView.Renderer {

    private Context mContext = null;

    private FrameBuffer fb = null;
    private World world = null;
    private Camera cam = null;

    public MyRenderer(Context context) {
        mContext = context;
    }

    @Override
    public void onSurfaceCreated(GL10 unused, EGLConfig config) {

    }

    @Override
    public void onSurfaceChanged(GL10 unused, int width, int height) {

        if ( fb != null ) {
            fb.dispose();
        }

        fb = new FrameBuffer(width, height);

        world = new World();
        cam = world.getCamera();

        InputStream objStream = mContext.getResources().openRawResource(R.raw.test_obj);
        Object3D[] loadRes = Loader.loadOBJ(objStream, null, 3);

        Object3D cube = loadRes[0];
        cube.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS | Object3D.COLLISION_CHECK_SELF);
        cube.build();

        world.addObject(cube);

        Light light = new Light(world);
        light.setPosition(new SimpleVector(0, -80, 0));
        light.setIntensity(140, 120, 120);
        light.setAttenuation(-1);

        world.setAmbientLight(20, 20, 20);

        cam.moveCamera(Camera.CAMERA_MOVEOUT, 200);
        cam.moveCamera(Camera.CAMERA_MOVEUP, 200);
        cam.lookAt(cube.getTransformedCenter());

    }

    @Override
    public void onDrawFrame(GL10 unused) {

        fb.clear(Color.RED);
        world.renderScene(fb);
        world.draw(fb);
        fb.display();

   }
}
Obj file in attachment as test.txt.
The main problem i'm don't see loaded object on the scene.
Can some help me please?

Pages: [1]