mmm yes this could work
Exists a way do create stencil in jpct?
Exists a way do create stencil in jpct?
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 Menupublic class ARRenderer implements GLSurfaceView.Renderer {
/**
* Allows subclasses to load markers and prepare the scene. This is called after
* initialisation is complete.
*/
public boolean configureARScene() {
return true;
}
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
// Transparent background
GLES10.glClearColor(0.0f, 0.0f, 0.0f, 0.f);
}
public void onSurfaceChanged(GL10 unused, int w, int h) {
GLES10.glViewport(0, 0, w, h);
}
public void onDrawFrame(GL10 gl) {
if (ARToolKit.getInstance().isRunning()) {
draw(gl);
}
}
/**
* Should be overridden in subclasses and used to perform rendering.
*/
public void draw(GL10 gl) {
GLES10.glClear(GLES10.GL_COLOR_BUFFER_BIT | GLES10.GL_DEPTH_BUFFER_BIT);
}
}
public class RenderARESX extends ARRenderer {
private World mWorld;
private Camera mCamera;
private FrameBuffer mBuffer ;
Matrix projMatrix = new Matrix();
@Override
public boolean configureARScene() {
Config.useRotationPivotFrom3DS=true;
// Initialize the game world and the camera
mWorld = new World();
mWorld.setClippingPlanes(0.1f, 10000.0f);
mWorld.setAmbientLight(150, 150, 150);
mCamera = mWorld.getCamera();
// Load all objects to the world
for (AmbientElement ae: MainScene.getInstance ().getAmbientElementsList()) {
// init AmbientElement
if (!ae.initRendering(mWorld) ) {
// If there was a problem, return false
return false;
}
//Log.wtf("esx","getmMarkerId = "+ae.getTracer().getmMarkerId());
}
return true;
}
@Override
public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) {
}
@Override
public void onSurfaceChanged(GL10 gl10, int w, int h) {
Config.useRotationPivotFrom3DS=true;
super.onSurfaceChanged(gl10, w, h);
mBuffer = new FrameBuffer(gl10,w,h);
}
float[] projection;
@Override
public void onDrawFrame(GL10 gl10) {
mBuffer.clear();
try {
projection = ARToolKit.getInstance().getProjectionMatrix();
projMatrix.setIdentity();
projMatrix.setDump(projection);
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
mCamera.setPosition(translation);
mCamera.setOrientation(dir, up);
for (AmbientElement ae : MainScene.getInstance().getAmbientElementsList()) {
ae.updateMarkerTransformation();
}
mWorld.renderScene(mBuffer);
mWorld.draw(mBuffer);
mBuffer.display();
}catch (Exception e){
Log.e("esx","ERRORE RenderARESX.onDrawFrame "+e.toString());
e.printStackTrace();
}
}
}
cubo = new TrackableObject3d("single;Data/patt.hiro;80", getCube());
you assign "single;Data/patt.hiro;80"
to Cube .How to assign different patterns to different objects ?
@Override
public void onDrawFrame(GL10 gl10) {
try {
float[] projectionCamera = ARToolKit.getInstance().getProjectionMatrix();
projMatrix.setIdentity();
projMatrix.setDump(projectionCamera);
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
cam.setPosition(translation);
cam.setOrientation(dir, up);
if (ARToolKit.getInstance().queryMarkerVisible(markerID)) {
float[] transformation = ARToolKit.getInstance().queryMarkerTransformation(markerID);
object3d.setIdentity();
object3d.setDump(transformation);
object3d.transformToGL();
thing.clearTranslation();
thing.translate(object3d.getTranslation());
thing.setRotationMatrix(object3d);
thing.scale(GlobalVar.getScale());
}
//buffer.clear(colorBLACK);
world.renderScene(buffer);
world.draw(buffer);
//buffer.display();
}catch (Exception e){
//Log.d("esx","ERRORE RenderARESX.java onDrawFrame(GL10 gl10) : "+e.toString());
e.printStackTrace();
}
}
Page created in 0.021 seconds with 14 queries.