Quote from: AeroShark333 on November 21, 2022, 10:27:21 PMThank you, its working, i didn't have the perfect texture though
Hello welcome!Quote from: Hellfire on November 21, 2022, 12:13:39 PMI'd recommend the blitting functions of the FrameBuffer:
Hello friends. How to display 2D Image to the camera?
I'am trying to make a Joystick
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
Quote from: Hellfire on November 21, 2022, 12:13:39 PMI'd recommend the blitting functions of the FrameBuffer:
Hello friends. How to display 2D Image to the camera?
I'am trying to make a Joystick
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);
}
}
}
}
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.
Page created in 0.024 seconds with 9 queries.