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 - msp-1

#1
Support / Re: setVertexOptimization
June 28, 2011, 04:56:12 PM
Thank you for your quick response!

I tried to use setShadingMode();
It's also very useful function.
But I want to make a object which has flat and smooth both type faces.
Then, next I want to try PolygonManager.

Should I use getTransformedNormal() function?
Could you tell me a example of using PolygonManager?
#2
Support / setVertexOptimization
June 27, 2011, 05:27:24 PM
Hello,
I have a question about setVertexOptimization.


This cube is separated into 6 faces in blender.
I tried to load this cube without vertexoptimization. (setVertexOptimization(false))

In my expectation, it become like a FLAT SHADING.
Which has sharp edges.
But shading result is not.
(Maybe shading result is not change by using vertexoptimization.)

How should I use setVertexOptimization?
#3
Support / Re: load3ds example
June 21, 2011, 03:11:50 PM
I found my mistake.

The cause was in my modeling data.
Sometimes my blender exports incorrect data.
Perhaps my modeling data contain some discrepancy polygons.
JPCT-AE loads other 3ds data correctly.

Thank you for your kind advices and great framework!
#4
Support / Re: load3ds example
May 26, 2011, 04:51:10 PM
Thank you for your usual support.
I understood about the restriction of 3d model and the memory size.

My 3ds model is simple cube.
File size is 4kb.
Polycount is 12.
And every faces are triangle.

To make sure I tried to load other 3ds model.
But result was same.
Maybe I made a basically fatal mistake...

If possible I want refer to example project.
Do you have downloadable load3ds example project?
#5
Support / Re: load3ds example
May 25, 2011, 05:56:01 PM
I'm very sorry for my huge posts
This is my console message.

[2011-05-25 23:42:51 - HelloWorld1] ------------------------------
[2011-05-25 23:42:51 - HelloWorld1] Android Launch!
[2011-05-25 23:42:51 - HelloWorld1] adb is running normally.
[2011-05-25 23:42:51 - HelloWorld1] Performing com.threed.jpct.example.HelloWorld activity launch
[2011-05-25 23:42:51 - HelloWorld1] Automatic Target Mode: launching new emulator with compatible AVD 'VirtualDevice2.2'
[2011-05-25 23:42:51 - HelloWorld1] Launching a new emulator with Virtual Device 'VirtualDevice2.2'
[2011-05-25 23:42:52 - HelloWorld1] New emulator found: emulator-5554
[2011-05-25 23:42:52 - HelloWorld1] Waiting for HOME ('android.process.acore') to be launched...
[2011-05-25 23:43:34 - HelloWorld1] WARNING: Application does not specify an API level requirement!
[2011-05-25 23:43:34 - HelloWorld1] Device API version is 8 (Android 2.2)
[2011-05-25 23:43:34 - HelloWorld1] HOME is up on device 'emulator-5554'
[2011-05-25 23:43:34 - HelloWorld1] Uploading HelloWorld1.apk onto device 'emulator-5554'
[2011-05-25 23:43:35 - HelloWorld1] Installing HelloWorld1.apk...
[2011-05-25 23:44:26 - HelloWorld1] Success!
[2011-05-25 23:44:27 - HelloWorld1] Starting activity com.threed.jpct.example.HelloWorld on device emulator-5554
[2011-05-25 23:44:30 - HelloWorld1] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.threed.jpct.example/.HelloWorld }
[2011-05-25 23:46:40 - Emulator] emulator: warning: opening audio input failed
[2011-05-25 23:46:40 - Emulator]


These message are not change If the program is working properly or not.

Then I tried to add  Log.e("tag", "message");

The message became exceed 1000 lines.
Which include various errors and warnings.
But It seems that the fatal problems is following lines.

05-25 14:44:57.569: INFO/jPCT-AE(277): Expanding buffers...4423680 bytes
05-25 14:44:57.809: DEBUG/dalvikvm(277): GC_FOR_MALLOC freed 7 objects / 280 bytes in 88ms
05-25 14:44:57.809: INFO/dalvikvm-heap(277): Forcing collection of SoftReferences for 4505616-byte allocation
05-25 14:44:57.919: DEBUG/dalvikvm(277): GC_FOR_MALLOC freed 0 objects / 0 bytes in 91ms
05-25 14:44:57.919: ERROR/dalvikvm-heap(277): Out of memory on a 4505616-byte allocation.
05-25 14:44:57.940: INFO/dalvikvm(277): "GLThread 8" prio=5 tid=7 RUNNABLE
05-25 14:44:57.940: INFO/dalvikvm(277):   | group="main" sCount=0 dsCount=0 s=N obj=0x43e421e0 self=0x21c228
05-25 14:44:57.949: INFO/dalvikvm(277):   | sysTid=283 nice=0 sched=0/0 cgrp=default handle=2212200
05-25 14:44:57.959: INFO/dalvikvm(277):   | schedstat=( 13983558315 3532757653 897 )
05-25 14:44:57.979: INFO/dalvikvm(277):   at com.threed.jpct.Loader.loadBinaryFile(Loader.java:~1063)
05-25 14:44:57.979: INFO/dalvikvm(277):   at com.threed.jpct.Loader.loadBinaryFile(Loader.java:1024)
05-25 14:44:57.979: INFO/dalvikvm(277):   at com.threed.jpct.Loader.load3DS(Loader.java:1409)
05-25 14:44:57.989: INFO/dalvikvm(277):   at com.threed.jpct.Loader.load3DS(Loader.java:143)
05-25 14:44:57.999: INFO/dalvikvm(277):   at com.threed.jpct.example.HelloWorld$MyRenderer.loadModel(HelloWorld.java:261)
05-25 14:44:58.009: INFO/dalvikvm(277):   at com.threed.jpct.example.HelloWorld$MyRenderer.onSurfaceChanged(HelloWorld.java:185)
05-25 14:44:58.029: INFO/dalvikvm(277):   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1325)
05-25 14:44:58.029: INFO/dalvikvm(277):   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
05-25 14:44:58.099: WARN/dalvikvm(277): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
05-25 14:44:58.211: INFO/ActivityManager(59): Displayed activity com.threed.jpct.example/.HelloWorld: 27323 ms (total 27323 ms)
05-25 14:44:58.239: ERROR/AndroidRuntime(277): FATAL EXCEPTION: GLThread 8
05-25 14:44:58.239: ERROR/AndroidRuntime(277): java.lang.OutOfMemoryError
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at com.threed.jpct.Loader.loadBinaryFile(Loader.java:1063)
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at com.threed.jpct.Loader.loadBinaryFile(Loader.java:1024)
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at com.threed.jpct.Loader.load3DS(Loader.java:1409)
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at com.threed.jpct.Loader.load3DS(Loader.java:143)
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at com.threed.jpct.example.HelloWorld$MyRenderer.loadModel(HelloWorld.java:261)
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at com.threed.jpct.example.HelloWorld$MyRenderer.onSurfaceChanged(HelloWorld.java:185)
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1325)
05-25 14:44:58.239: ERROR/AndroidRuntime(277):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
05-25 14:44:58.409: WARN/ActivityManager(59):   Force finishing activity com.threed.jpct.example/.HelloWorld


What is my mistake?

And I'm just trying Object3D.mergeAll...
#6
Support / Re: load3ds example
May 22, 2011, 06:09:18 AM
Thank you very quick response.
And I'm sorry about my bad English and explanation.

When I try to run the program, following dialog appear.
------
!Sorry!
The application HelloWorld(process com.threed.jpct.example) has stopped unexpectedly.
Please try again
------

I tried to change the code
( thing = loadModel("res/" + thingName + ".3ds", thingScale); )
to
( thing = Primitives.getCube(15); )
It works correctly.

Maybe problem is in last function (Object3D loadModel())....
#7
Support / load3ds example
May 21, 2011, 09:40:05 PM
Hello,
I have started learning about jpct-ae.
At first I try to load 3ds model which does not have any texture.
I have modified jpct example code.
But it doesn't work...
My code is follow

package com.threed.jpct.example;

import java.io.*;

import java.lang.reflect.Field;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;

import com.threed.jpct.*;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.opengl.GLSurfaceView.EGLConfigChooser;
import android.opengl.GLSurfaceView.Renderer;
import android.util.Log;

public class HelloWorld extends Activity {
    private String thingName = "temp";
    private int thingScale = 1;//end
private static HelloWorld master = null;

private GLSurfaceView mGLView;
private MyRenderer renderer = null;
private FrameBuffer buffer = null;

private World world = null;
private RGBColor back = new RGBColor(50, 50, 100);

private float touchTurn = 0;
private float touchTurnUp = 0;

private float xpos = -1;
private float ypos = -1;

private Object3D thing = null;
private int fps = 0;

private Light sun = null;
private Camera cam = null;

AssetManager assMan;
InputStream is;
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
mGLView = new GLSurfaceView(getApplication());
renderer = new MyRenderer();
mGLView.setRenderer(renderer);
setContentView(mGLView);
}

@Override
protected void onPause() {
super.onPause();
mGLView.onPause();
}

@Override
protected void onResume() {
super.onResume();
mGLView.onResume();
}

protected void onStop() {
super.onStop();
}

public boolean onTouchEvent(MotionEvent me) {

if (me.getAction() == MotionEvent.ACTION_DOWN) {
xpos = me.getX();
ypos = me.getY();
return true;
}

if (me.getAction() == MotionEvent.ACTION_UP) {
xpos = -1;
ypos = -1;
touchTurn = 0;
touchTurnUp = 0;
return true;
}

if (me.getAction() == MotionEvent.ACTION_MOVE) {
float xd = me.getX() - xpos;
float yd = me.getY() - ypos;

xpos = me.getX();
ypos = me.getY();

touchTurn = xd / -100f;
touchTurnUp = yd / -100f;
return true;
}

try {
Thread.sleep(15);
} catch (Exception e) {
// No need for this...
}

return super.onTouchEvent(me);
}

protected boolean isFullscreenOpaque() {
return true;
}

class MyRenderer implements GLSurfaceView.Renderer {

private long time = System.currentTimeMillis();
private boolean stop = false;

public MyRenderer() {
}

public void stop() {
stop = true;
}

public void onSurfaceChanged(GL10 gl, int w, int h) {
if (buffer != null) {
buffer.dispose();
}
buffer = new FrameBuffer(gl, w, h);

if (master == null) {

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

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

thing = loadModel("res/" + thingName + ".3ds", thingScale);
        thing.build();

world.addObject(thing);

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

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

if (master == null) {
Logger.log("Saving master Activity!");
master = HelloWorld.this;
}
}
}

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
}

public void onDrawFrame(GL10 gl) {

try {
if (!stop) {
if (touchTurn != 0) {
thing.rotateY(touchTurn);
touchTurn = 0;
}

if (touchTurnUp != 0) {
thing.rotateX(touchTurnUp);
touchTurnUp = 0;
}

buffer.clear(back);
world.renderScene(buffer);
world.draw(buffer);
buffer.display();

if (System.currentTimeMillis() - time >= 1000) {
Logger.log(fps + "fps");
fps = 0;
time = System.currentTimeMillis();
}
fps++;
} else {
if (buffer != null) {
buffer.dispose();
buffer = null;
}
}
} catch (Exception e) {
Logger.log(e, Logger.MESSAGE);
}
}

    private Object3D loadModel(String filename, float scale) {
assMan = getResources().getAssets();
is= new InputStream() {
@Override
public int read() throws IOException {
return 0;
}
};
        Object3D[] model = Loader.load3DS(is,scale);
        Object3D o3d = new Object3D(0);
        Object3D temp = null;
        for (int i = 0; i < model.length; i++) {
            temp = model[i];
            temp.setCenter(SimpleVector.ORIGIN);
            temp.rotateX((float)( -.5*Math.PI));
            temp.rotateMesh();
            temp.setRotationMatrix(new Matrix());
            o3d = Object3D.mergeObjects(o3d, temp);
            o3d.build();
        }
        return o3d;
    }
}
}


Could you tell me that what is my mistake?
Or is there simple load3ds example for android?

Thank you.