Main Menu

Recent posts

#81
Support / Re: How to display 2D image to...
Last post by Hellfire - November 22, 2022, 12:39:50 PM
Quote from: AeroShark333 on November 21, 2022, 10:27:21 PM
Hello welcome!

Quote from: Hellfire on November 21, 2022, 12:13:39 PM
Hello friends. How to display 2D Image to the camera?
I'am trying to make a Joystick
I'd recommend the blitting functions of the FrameBuffer:
https://www.jpct.net/jpct-ae/doc/com/threed/jpct/FrameBuffer.html#blit-com.threed.jpct.Texture-float-float-float-float-float-float-float-float-int-boolean-

I hope this helps :)
Thank you, its working, i didn't have the perfect texture though  ::) ::)
#82
Support / Re: How to display 2D image to...
Last post by AeroShark333 - November 21, 2022, 10:27:21 PM
Hello welcome!

Quote from: Hellfire on November 21, 2022, 12:13:39 PM
Hello friends. How to display 2D Image to the camera?
I'am trying to make a Joystick
I'd recommend the blitting functions of the FrameBuffer:
https://www.jpct.net/jpct-ae/doc/com/threed/jpct/FrameBuffer.html#blit-com.threed.jpct.Texture-float-float-float-float-float-float-float-float-int-boolean-

I hope this helps :)
#83
Support / How to display 2D image to 3D ...
Last post by Hellfire - November 21, 2022, 12:13:39 PM
Hello friends. How to display 2D Image to the camera?
I'am trying to make a Joystick
#84
News / Re: Maintainability
Last post by GMas - November 14, 2022, 12:18:04 PM
Thanks for your answers. So far nothing very important to bring up. I'm just starting off the bench  ;D and testing the lib.
#85
Support / Re: Bug with diffuse lighting
Last post by AeroShark333 - November 13, 2022, 03:49:43 AM
I tried to modify the test case to something similar as what I had but it seems to be working fine...

I tried to look again at my own situation too but it seems fine now...  ???
I think I just made a mistake myself along the way
Sorry for bringing this up, I guess it was an error on my side after all
I think I forgot to set the intensities for some lights and they showed the wrong color (white by default...)

I'll report back if there was something fishy going on still but I suppose it is not the case; so... case closed for now
#86
Support / Re: Bug with diffuse lighting
Last post by EgonOlsen - November 11, 2022, 11:38:10 AM
I made this test case, but I fail to see an issue with it:




package com.threed.jpct.example;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;

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

import java.util.ArrayList;
import java.util.List;

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

public class HelloWorld extends Activity {
    private GLSurfaceView mGLView;
    private MyRenderer renderer = null;
    private FrameBuffer fb = null;
    private World world = null;
    private final List<Light> lights = new ArrayList<>();
    private float[] dir = null;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLView = new GLSurfaceView(getApplication());
        mGLView.setEGLContextClientVersion(2);
        mGLView.setPreserveEGLContextOnPause(true);

        renderer = new MyRenderer();
        mGLView.setRenderer(renderer);
        setContentView(mGLView);
    }

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

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

    @Override
    protected void onStop() {
        super.onStop();
        System.exit(0);
    }


    class MyRenderer implements GLSurfaceView.Renderer {

        public MyRenderer() {
            //
        }

        public void onSurfaceChanged(GL10 gl, int w, int h) {
            world = new World();
            world.setAmbientLight(0, 0, 0);

            SimpleVector[] cols = new SimpleVector[]{
                    SimpleVector.create(64, 128, 64),
                    SimpleVector.create(0, 128, 128),
                    SimpleVector.create(128, 0, 128),
                    SimpleVector.create(128, 128, 0),
                    SimpleVector.create(0, 0, 128),
                    SimpleVector.create(128, 0, 0),
                    SimpleVector.create(0, 128, 0),
                    SimpleVector.create(0, 64, 64)};

            for (int i = 0; i < 8; i++) {
                Object3D obj = Primitives.getSphere(50, 8);
                world.addObject(obj);
                int pos = 30 + (i - 7) * 10;
                obj.translate(10 - 20 * (i % 2), pos, 0);
                obj.build();
            }

            for (int i = 0; i < 8; i++) {
                int pos = 30 + (i - 7) * 30;
                Light light = new Light(world);
                light.setIntensity(cols[i]);
                SimpleVector sv = new SimpleVector();
                sv.y = pos;
                sv.z -= 20 - 40 * (i % 2);
                light.setPosition(sv);
                lights.add(light);
            }

            dir = new float[lights.size()];
            for (int i = 0; i < lights.size(); i++) {
                dir[i] = 1f;
            }

            Camera cam = world.getCamera();
            cam.moveCamera(Camera.CAMERA_MOVEOUT, 45);
            cam.lookAt(SimpleVector.ORIGIN);

            fb = new FrameBuffer(w, h);
        }

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

        public void onDrawFrame(GL10 gl) {
            fb.clear(RGBColor.BLACK);
            world.renderScene(fb);
            world.draw(fb);
            fb.display();

            for (int i = 0; i < lights.size(); i++) {
                Light light = lights.get(i);
                SimpleVector sv = light.getPosition();
                sv.y += dir[i];
                if (sv.y > 150 || sv.y < -150) {
                    dir[i] *= -1f;
                }
                light.setPosition(sv);
            }
        }
    }
}



Do you have a test case that shows this problem?
#87
Support / Re: Bug with diffuse lighting
Last post by AeroShark333 - November 09, 2022, 04:00:05 PM
Thank you!
#88
Support / Re: Bug with diffuse lighting
Last post by EgonOlsen - November 09, 2022, 08:27:19 AM
I'll have a look...
#89
News / Re: Maintainability
Last post by EgonOlsen - November 09, 2022, 08:26:02 AM
As Aero said, it's not a problem. The stuff in the util-package is decoupled from the engine, everything that is done in there can be done with the means provided by the public interfaces.
#90
News / Re: Maintainability
Last post by AeroShark333 - November 09, 2022, 02:35:28 AM
Quote from: GMas on November 08, 2022, 05:34:23 PM
Thanks.

I'm thinking adding some more ExtendedPrimitives as Polyhedron shapes. But regarding your license this is not possible.

You could always implement such extension of general primitive Object3D's (in a new seperate class) yourself (and share them here for others) ;)