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 - laihua

Pages: [1]
Projects / why load a black model ,but i can not see anything
« on: September 09, 2016, 11:52:43 am »
hello everyone,Administrator
I loaded a black cube model now, but I can't see my load model
can you tell me how to load a balck model?

Support / Re: Just want to ask for help
« on: August 26, 2016, 10:37:43 am »
Thank you ,  This was a great help to me!!!   
 In addition to the API documentation , and which have a good learning materials???

Support / Re: Just want to ask for help
« on: August 26, 2016, 04:48:02 am »
Thank you very much !  and I have look at MouseFollowDemo  and then make an Android demo ,But I failed :'( .Maybe I use wrong.Maybe I used the wrong, because I'm not very familiar with the coordinate system for JPCT.
My goal is where I click, the ball will appear in where    This goal is very simple, but I am very confused now . so i want to you can help me . thank you :)
and this is my

Code: [Select]

import android.content.Context;
import android.opengl.GLSurfaceView;

import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Interact2D;
import com.threed.jpct.Light;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.World;

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

public class DeskRenderer implements GLSurfaceView.Renderer {

    private Context mContext;
    private FrameBuffer fb = null;
    private Object3D ball = null;
    private World world = null;
    private Light light = null;
    private Camera camera = null;
    public float horizontal;
    public float vertical;
    public float x = 0;
    public float y = 0;

    public DeskRenderer(Context mContext) {
        this.mContext = mContext;

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        world = new World();
        ball = Primitives.getSphere(5.0f);
        // light
        world.setAmbientLight(255, 255, 255);
        light = new Light(world);
        light.setIntensity(255, 255, 255);
        // camera
        camera = world.getCamera();
        camera.moveCamera(Camera.CAMERA_MOVEOUT, 100);

    public void onSurfaceChanged(GL10 gl, int width, int height) {
        if (fb != null) {
            fb = null;
        fb = new FrameBuffer(gl, width, height);
    public void onDrawFrame(GL10 gl) {
        SimpleVector ray = Interact2D.reproject2D3DWS(world.getCamera(), fb, (int) x, (int) y);
        if (ray != null) {
            float f = world.calcMinDistance(camera.getPosition(), ray, 1000);
            if (f != Object3D.COLLISION_NONE) {
                SimpleVector offset = new SimpleVector(ray);
                ray = ray.calcSub(offset);


When click on the screen, another class will  set value to x and y

Support / Re: Just want to ask for help
« on: August 25, 2016, 10:14:39 am »
thank for your reply ,and I have use reproject2D3DWS-method like this  (just for test fb is (1080*1920))
 SimpleVector simpleVector1 = Interact2D.reproject2D3DWS(camera, fb, 1000, 1000,1f);

 SimpleVector simpleVector2 = Interact2D.project3D2D(camera, fb, simpleVector1);

and this is debug result:
simpleVector2 = {SimpleVector@3889} "(544.55444,960.39606,0.00990099)"
simpleVector1 = {SimpleVector@3884} "(0.5324074,0.0462963,1.0)"
 why simpleVector2 not (1000,1000,1) 

the second question

For example, I loaded a cuboid model, I need to get a cuboid vertex coordinates, what should I do?

I am a Chinese, English ability is not very good.I believe you should know what I mean :)

Support / Just want to ask for help
« on: August 24, 2016, 08:44:42 am »
Hello  everyone :
      I want to ask you some questions,specific as follows:

The first:
 how to converts the coordinates of the screen to the inside of the camera 3 d coordinate?  because I need to be a model accurately on a certain position of the screen.
I have use
But the ball is in the center of the screen is, fb is 1920 * 1080

The second:
How to get somewhere on the obj model coordinates, because I want to this point as the center of rotation of the model, rather than the center of gravity of the models

Pages: [1]