Main Menu
Menu

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.

Show posts Menu

Messages - cefengxu

#46
Support / Re: Serious Help Needed[AR]
October 27, 2015, 11:55:44 AM
vuforia should be best , because you can search lots of tutorial about vuforia + jpct

and then , JPCT should be a easy way to inject the rendering code into the project~~
#47
i have fix this issue , i will post a tutorial later.

Question: and then , the model could not be change ( always be laid on the mark ,as shown as the attached ) even i use the function rotationMatirx ;

my code as belown:


    public void onDrawFrame(GL10 unused) {
float[] projection = ARNativeActivity.getProjectM();
Matrix projMatrix = new Matrix();
projMatrix.setDump(projection);
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
cam.setPosition(translation);
cam.setOrientation(dir, up);

float[] transformation = ARNativeActivity.getTransformationM();
Matrix dump = new Matrix();
dump.setDump(transformation);
dump.transformToGL();
alita.clearTranslation();
alita.translate(dump.getTranslation());
alita.setRotationMatrix(dump);

alita.setState(stat);
alita.animate(ticks);
}
#48
Support / Re: Serious Help Needed[AR]
October 27, 2015, 10:20:29 AM
for such issue, you need to got a project which preview rendered by gl ;
and then , the render class could be easy to find , such as the onDrawFrame(),  onSurfaceChange();
at the end , you can inject the JPCT-AE into your code;
#49
i have fix this issue , i will post a tutorial later.

Question: and then , the model could not be change ( always be laid on the mark ,as shown as the attached ) even i use the function rotationMatirx ;

my code as belown:


    public void onDrawFrame(GL10 unused) {
float[] projection = ARNativeActivity.getProjectM();
Matrix projMatrix = new Matrix();
projMatrix.setDump(projection);
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
cam.setPosition(translation);
cam.setOrientation(dir, up);

float[] transformation = ARNativeActivity.getTransformationM();
Matrix dump = new Matrix();
dump.setDump(transformation);
dump.transformToGL();
alita.clearTranslation();
alita.translate(dump.getTranslation());
alita.setRotationMatrix(dump);

alita.setState(stat);
alita.animate(ticks);
}
#50
Support / Re: Serious Help Needed[AR]
October 27, 2015, 03:15:57 AM
you need to coding basic on a ready-make AR engine , for example, the Vuforia ~ or the ARToolkit
#51
firstly, you need to choose a project or engine of AR , and let me know;
secondly ,  the jpct-ae just for rendering;
#52
Dear Master :

Purpose :
i need to set a  [ real-time matrix ] for the obj to realize the AR ;

as the normally, i can use the "fucntion GLES20.glUniformMatrix4fv" to set a matrix to the shader , and then calculate the right position of the model on the screen;

i can get the translate matrix output by ARToolkit in real-time ;
but  i do not know how to set the matrix when i use the jpct-ae to rendering.

i have tried to use the "jpct-ae-fucniton model.setTranslationMatrix(mat);" , but all the result  for scale , position and direction  are wrong.


question : how to use the translationmatrix in jpct as will as GLES20function::GLES20.glUniformMatrix4fv??
#53
it's work. i have change the textureID of the preview data, and it's work.
#54
Bones / [ resolved ] how to exp the Ogre3D's format
October 22, 2015, 11:50:14 AM
Dear raft:

my question is :
1- how to exp the Ogre3D's format. or which plugging i need to download?
2- what is the format name of the Ogre3D's format ???

#55
follow the help from EgonOlsen , i have loading a md2 model on the preview data.

However, the texture of the model have been changed and overwrited by the preview buffer texture grab of camera. Pls find  the attached , shown such case
so , how can i change the textureID manually or have another way to fix such issue .
#56
got it !~ just using another constructor FrameBuffer(/*unused, */width, height);

however , i got another problem . due to it's a new issue so iwill post new one.

thanks again , i spents 8 hours on line to waiting for you today.

::)


#57
Thank you so much !!!

but ,as you said ,"You have to use the constructor without it."
actually, i still have no idea how to do ??

i try to use the function [ setEGLContextClientVersion(1)] to  fix it just now but no work~~
#58
BTW, i post my  " render class  implements Renderer " for you :

public class Renderer implements GLSurfaceView.Renderer {

private  final Context context;
private int program;

private int aPositionLocation;
private int uMatrixLocation;

private final float[] projectionMatrix = new float[16];
private final float[] modelMatrix = new float[16];

public int flag1;
public int flag2;
public int model_index;

private FrameBuffer fb = null;
private World world = null;
private RGBColor back = new RGBColor(100, 100, 150);
private boolean stop = false;
private Light sun = null;
private Camera cam;
private long ticks = 0;

private Model alita = null;
public static Context con;
private Resources res=null;
public static int stat=0;
public static List<String> animations=null;
private Object3D cube = null;

public Renderer(Context context) {
flag1 = 0;
flag2 = 1;
model_index = 0 ;
this.context = context;
Model.context = context;
}

    public void onSurfaceCreated(GL10 unused, EGLConfig config) {               
    ARNativeActivity.nativeSurfaceCreated();
   
   
glClearColor(0.0f,0.0f,0.0f,0.0f);

    }

    private int sub_w;
    private int sub_h;
    public void onSurfaceChanged(GL10 unused, int width, int height) {       
    ARNativeActivity.nativeSurfaceChanged(width, height);
glViewport(0, 0,width, height);
sub_w = width;
sub_h = height;

if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(unused, width, height);

world = new World();
world.setAmbientLight(20, 20, 20);

sun = new Light(world);
sun.setIntensity(250, 250, 250);


Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(context.getResources().getDrawable(R.drawable.icon)), 64, 64));
TextureManager.getInstance().addTexture("texture", texture);

cube = Primitives.getCube(50);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.strip();
cube.build();

world.addObject(cube);

Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(cube.getTransformedCenter());

SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();


    }

    public void onDrawFrame(GL10 unused) {

ARNativeActivity.nativeDrawFrame();

// try {
if (fb != null) {
fb.clear();
world.renderScene(fb);
world.draw(fb);
fb.display();
Logger.log("Drawing thread running!", Logger.MESSAGE);
}


    } 
#59
i have no idea witch version but  i got the jpct on " http://www.jpct.net/download.html " one month ago.

all i did just posted the code from " Helloworld Project "  to my project.  within three function as belown:
- onSurfaceCreated
- onSurfaceChanged
- onDrawFrame

to show a cube on the real-time preview on the phone ( lots of android phone were tried .)
the log you need was show belown:
thanks you again ,EgonOlsen

10-22 10:24:47.643: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.653: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.653: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.653: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.713: I/AssetHelper(25659): Using cached folder 'Data'.
10-22 10:24:47.723: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.723: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.903: I/ARNativeNative(25659): nativeDisplayParametersChanged orientation=1, size=1920x1080@480pi
10-22 10:24:47.923: D/wangcy9(25659): setStatusIcon occur wrong theme!
10-22 10:24:47.963: I/ARNativeNative(25659): nativeCreate
10-22 10:24:47.963: E/ARNativeNative(25659): Marker count = 1
10-22 10:24:47.963: I/ARNativeNative(25659): nativeStart
10-22 10:24:47.963: I/libar(25659): Using default video config.
10-22 10:24:47.973: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.983: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.993: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:47.993: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:48.013: D/OpenGLRenderer(25659): Render dirty regions requested: true
10-22 10:24:48.033: D/ActivityThread(25659): updateParameter() changefont = false; fontpath=/system/fonts/LenovoFont.ttf; titlefontpath=/system/fonts/LenovoFont.ttf
10-22 10:24:48.033: D/FontThemeManager(25659): FontThemeManager createThemeFont typefacetype=0, curfontpath=/system/fonts/LenovoFont.ttf
10-22 10:24:48.043: I/ARNativeNative(25659): nativeStop
10-22 10:24:48.043: I/ARNativeNative(25659): nativeDestroy
10-22 10:24:48.053: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:48.153: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:48.183: I/ARNativeNative(25659): nativeDisplayParametersChanged orientation=1, size=1920x1080@480pi
10-22 10:24:48.183: D/wangcy9(25659): setStatusIcon occur wrong theme!
10-22 10:24:48.213: I/ARNativeNative(25659): nativeCreate
10-22 10:24:48.213: E/ARNativeNative(25659): Marker count = 1
10-22 10:24:48.223: I/ARNativeNative(25659): nativeStart
10-22 10:24:48.223: I/libar(25659): Using default video config.
10-22 10:24:48.243: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:48.243: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:48.243: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:48.243: I/Configuration(25659): Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
10-22 10:24:48.273: D/ViewRootImpl(25659): loadSystemProperties PersistDebugEvent: false RoDebugEvent: false
10-22 10:24:48.353: I/Adreno-EGL(25659): <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.021_msm8916_64_LA.BR.1.1.2_RB1__release_AU ()
10-22 10:24:48.353: I/Adreno-EGL(25659): OpenGL ES Shader Compiler Version: E031.25.03.02
10-22 10:24:48.353: I/Adreno-EGL(25659): Build Date: 03/12/15 Thu
10-22 10:24:48.353: I/Adreno-EGL(25659): Local Branch: mybranch8269035
10-22 10:24:48.353: I/Adreno-EGL(25659): Remote Branch: quic/LA.BR.1.1.2_rb1.13
10-22 10:24:48.353: I/Adreno-EGL(25659): Local Patches: NONE
10-22 10:24:48.353: I/Adreno-EGL(25659): Reconstruct Branch: AU_LINUX_ANDROID_LA.BR.1.1.2_RB1.05.00.02.031.021 +  NOTHING
10-22 10:24:48.353: I/OpenGLRenderer(25659): Initialized EGL, version 1.4
10-22 10:24:48.373: D/OpenGLRenderer(25659): Enabling debug mode 0
10-22 10:24:48.383: I/qdutils(25659): PartialUpdate status: Disabled
10-22 10:24:48.383: I/qdutils(25659): Left Align: 0
10-22 10:24:48.383: I/qdutils(25659): Width Align: 0
10-22 10:24:48.383: I/qdutils(25659): Top Align: 0
10-22 10:24:48.383: I/qdutils(25659): Height Align: 0
10-22 10:24:48.383: I/qdutils(25659): Min ROI Width: 0
10-22 10:24:48.383: I/qdutils(25659): Min ROI Height: 0
10-22 10:24:48.383: I/qdutils(25659): Needs ROI Merge: 0
10-22 10:24:48.383: I/qdutils(25659): Dynamic Fps: Disabled
10-22 10:24:48.383: I/qdutils(25659): Min Panel fps: 0
10-22 10:24:48.383: I/qdutils(25659): Max Panel fps: 0
10-22 10:24:48.483: I/CameraSurface(25659): Opening camera.
10-22 10:24:49.223: I/ARNativeNative(25659): nativeVideoInit
10-22 10:24:49.223: I/ARNativeNative(25659): Video camera 0 (rear), 640x480 format AR_PIXEL_FORMAT_NV21, 460800-byte buffer.
10-22 10:24:49.223: I/libar(25659): cparamSearch beginning search for LENOVO/Lenovo Z90/msm8916, camera 0, aspect ratio 4:3.
10-22 10:24:49.223: E/libar(25659): Error during cparamSearch. Internet connection unavailable.
10-22 10:24:49.223: E/ARNativeNative(25659): Unable to automatically determine camera parameters. Using default.
10-22 10:24:49.223: I/ARNativeNative(25659): *** Camera Parameter resized from 1280, 1024. ***
10-22 10:24:49.223: I/ARNativeNative(25659): *** Camera Parameter ***
10-22 10:24:49.223: I/libar(25659): --------------------------------------
10-22 10:24:49.223: I/libar(25659): SIZE = 640, 480
10-22 10:24:49.223: I/libar(25659): Distortion factor: k1=0.1147807688, k2=-0.5208189487, p1=-0.0002069871, p2=-0.0040593124
10-22 10:24:49.223: I/libar(25659):                   fx=674.171631, fy=633.898071, x0=318.297791, y0=237.900467, s=0.993923
10-22 10:24:49.223: I/libar(25659): 678.29388
10-22 10:24:49.223: I/libar(25659): 0.00000
10-22 10:24:49.223: I/libar(25659): 318.29779
10-22 10:24:49.223: I/libar(25659): 0.00000
10-22 10:24:49.223: I/libar(25659): 0.00000
10-22 10:24:49.223: I/libar(25659): 637.77411
10-22 10:24:49.223: I/libar(25659): 237.90047
10-22 10:24:49.223: I/libar(25659): 0.00000
10-22 10:24:49.223: I/libar(25659): 0.00000
10-22 10:24:49.223: I/libar(25659): 0.00000
10-22 10:24:49.223: I/libar(25659): 1.00000
10-22 10:24:49.223: I/libar(25659): 0.00000
10-22 10:24:49.223: I/libar(25659): --------------------------------------
10-22 10:24:49.263: W/GL2SurfaceView(25659): creating OpenGL ES 2.0 context
10-22 10:24:49.273: D/ViewRootImpl(25659): loadSystemProperties PersistDebugEvent: false RoDebugEvent: false
10-22 10:24:49.283: I/Choreographer(25659): Skipped 59 frames!  The application may be doing too much work on its main thread.
10-22 10:24:49.293: I/ARNativeNative(25659): nativeSurfaceCreated
10-22 10:24:49.303: I/ARNativeNative(25659): nativeSurfaceChanged backingWidth=1920, backingHeight=1080
10-22 10:24:49.323: I/jPCT-AE(25659): GL context is 951340409
10-22 10:24:49.333: E/libEGL(25659): called unimplemented OpenGL ES API
10-22 10:24:49.333: W/Adreno-ES20(25659): <process_gl_state_enables:519>: GL_INVALID_ENUM
10-22 10:24:49.333: I/jPCT-AE(25659): OpenGL vendor:     Qualcomm
10-22 10:24:49.333: I/jPCT-AE(25659): OpenGL renderer:   Adreno (TM) 405
10-22 10:24:49.333: I/jPCT-AE(25659): OpenGL version:    OpenGL ES 3.0 V@100.0 AU@05.00.02.031.021 (GIT@)
10-22 10:24:49.333: I/jPCT-AE(25659): OpenGL renderer initialized (using 0/0 texture stages)
10-22 10:24:49.343: I/jPCT-AE(25659): Adding Lightsource: 0
10-22 10:24:49.353: I/jPCT-AE(25659): Loading Texture...
10-22 10:24:49.353: I/jPCT-AE(25659): Texture loaded...16384 bytes/64*64 pixels!
10-22 10:24:49.363: I/jPCT-AE(25659): Normal vectors calculated in 2ms!
10-22 10:24:49.363: I/jPCT-AE(25659): Memory usage before compacting: 18893 KB used out of 48206 KB. Max. memory available to the VM is 131072 KB.
10-22 10:24:49.403: I/art(25659): Explicit concurrent mark sweep GC freed 5101(407KB) AllocSpace objects, 9(272KB) LOS objects, 64% free, 17MB/49MB, paused 795us total 38.622ms
10-22 10:24:49.403: I/ARNativeNative(25659): nativeVideoFrame !VIDEO
10-22 10:24:49.403: I/ARNativeNative(25659): nativeVideoFrame !VIDEO
10-22 10:24:49.403: I/ARNativeNative(25659): nativeVideoFrame !VIDEO
10-22 10:24:49.433: I/ARNativeNative(25659): nativeVideoFrame !VIDEO
10-22 10:24:49.433: I/ARNativeNative(25659): nativeVideoFrame !VIDEO
10-22 10:24:49.433: I/Timeline(25659): Timeline: Activity_idle id: android.os.BinderProxy@249d44e6 time:31203199
10-22 10:24:49.443: I/Timeline(25659): Timeline: Activity_idle id: android.os.BinderProxy@249d44e6 time:31203200
10-22 10:24:49.453: I/art(25659): Explicit concurrent mark sweep GC freed 776(55KB) AllocSpace objects, 0(0B) LOS objects, 64% free, 17MB/49MB, paused 712us total 29.421ms
10-22 10:24:49.603: I/jPCT-AE(25659): Memory usage after compacting: 18162 KB used out of 50929 KB. Max. memory available to the VM is 131072 KB.
10-22 10:24:49.603: I/ARNativeNative(25659): nativeDrawFrame
10-22 10:24:49.603: I/ARNativeNative(25659): Initialising ARView
10-22 10:24:49.603: I/ARNativeNative(25659): Setting up argl.
10-22 10:24:49.613: I/ARNativeNative(25659): argl setup OK.
10-22 10:24:49.613: I/ARNativeNative(25659): ARView initialised.
10-22 10:24:49.613: E/ARNativeNative(25659): Viewport={0, -180, 1920, 1440}
10-22 10:24:49.613: I/ARNativeNative(25659): after glClear() glError (0x500)
10-22 10:24:49.613: W/Adreno-ES20(25659): <process_gl_state_enables:519>: GL_INVALID_ENUM
10-22 10:24:49.613: W/jPCT-AE(25659): [ 1445480689625 ] - WARNING: State: 0/0/0/0/0/0/0
10-22 10:24:49.653: I/ARNativeNative(25659): nativeVideoFrame
10-22 10:24:49.653: E/AndroidRuntime(25659): FATAL EXCEPTION: GLThread 646
10-22 10:24:49.653: E/AndroidRuntime(25659): Process: org.artoolkit.ar.samples.ARNative, PID: 25659
10-22 10:24:49.653: E/AndroidRuntime(25659): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
10-22 10:24:49.653: E/AndroidRuntime(25659): at com.threed.jpct.CompiledInstance._fill(CompiledInstance.java:1223)
10-22 10:24:49.653: E/AndroidRuntime(25659): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:844)
10-22 10:24:49.653: E/AndroidRuntime(25659): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:168)
10-22 10:24:49.653: E/AndroidRuntime(25659): at com.threed.jpct.World.compile(World.java:2091)
10-22 10:24:49.653: E/AndroidRuntime(25659): at com.threed.jpct.World.renderScene(World.java:1061)
10-22 10:24:49.653: E/AndroidRuntime(25659): at org.artoolkit.ar.samples.ARNative.Renderer.onDrawFrame(Renderer.java:215)
10-22 10:24:49.653: E/AndroidRuntime(25659): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
10-22 10:24:49.653: E/AndroidRuntime(25659): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
10-22 10:24:49.853: I/CameraSurface(25659): Closing camera.
10-22 10:24:50.053: D/ActivityThread(25659): updateParameter() changefont = false; fontpath=/system/fonts/LenovoFont.ttf; titlefontpath=/system/fonts/LenovoFont.ttf
10-22 10:24:50.053: D/FontThemeManager(25659): FontThemeManager createThemeFont typefacetype=0, curfontpath=/system/fonts/LenovoFont.ttf
10-22 10:24:51.513: I/ARNativeNative(25659): nativeStop
10-22 10:24:51.533: I/ARNativeNative(25659): nativeDestroy
#60
Dear master:

i have got a problem and i still could not fix it :

Purpose : using JPCT to render 3D Model for AR basic on ARToolkit;
Platform: Eclipse , ARToolkit Example: ARNative;
jpct: i using the JPCTdemo (helloworld) to add the jpct's code into my code for rendering a cube on the preview image;

However :
the error will be shown as follown when run the function "renderScene(fb)"

10-21 16:44:00.737: E/AndroidRuntime(20351): FATAL EXCEPTION: GLThread 545
10-21 16:44:00.737: E/AndroidRuntime(20351): Process: org.artoolkit.ar.samples.ARNative, PID: 20351
10-21 16:44:00.737: E/AndroidRuntime(20351): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
10-21 16:44:00.737: E/AndroidRuntime(20351): at com.threed.jpct.CompiledInstance._fill(CompiledInstance.java:1223)
10-21 16:44:00.737: E/AndroidRuntime(20351): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:844)
10-21 16:44:00.737: E/AndroidRuntime(20351): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:168)
10-21 16:44:00.737: E/AndroidRuntime(20351): at com.threed.jpct.World.compile(World.java:2091)
10-21 16:44:00.737: E/AndroidRuntime(20351): at com.threed.jpct.World.renderScene(World.java:1061)
10-21 16:44:00.737: E/AndroidRuntime(20351): at org.artoolkit.ar.samples.ARNative.Renderer.onDrawFrame(Renderer.java:210)
10-21 16:44:00.737: E/AndroidRuntime(20351): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
10-21 16:44:00.737: E/AndroidRuntime(20351): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)