Skip to content

Commit 6e22cfe

Browse files
committed
no need to call background() in AR sketches
1 parent 22b9c5f commit 6e22cfe

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

debug/apps/arscene/src/main/java/arscene/Sketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void draw() {
2525
// surface.camera.getPose();
2626
// surface.frame.getLightEstimate();
2727

28-
background(0);
28+
// background(0);
2929
lights();
3030

3131

mode/libraries/ar/src/processing/ar/PGraphicsAR.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
package processing.ar;
2424

25+
import android.opengl.GLES11Ext;
2526
import android.view.SurfaceHolder;
2627

2728
import com.google.ar.core.Anchor;
@@ -68,20 +69,25 @@ protected PGL createPGL(PGraphicsOpenGL pGraphicsOpenGL) {
6869
public void beginDraw() {
6970
super.beginDraw();
7071
updateView();
71-
}
72-
7372

74-
@Override
75-
protected void backgroundImpl() {
73+
background(0);
7674
surfar.renderBackground();
7775

78-
// surfar.getAnchors();
76+
// flush();
77+
// pgl.clearBackground(backgroundR, backgroundG, backgroundB, backgroundA,
78+
// !hints[DISABLE_DEPTH_MASK], true);
79+
}
7980

8081

81-
// The helpers (planes, point clouds, should be drawn using Processing primitives, so this could
82-
// go after updateView() in beginDraw().
83-
// surfar.renderHelpers();
84-
}
82+
// @Override
83+
// protected void backgroundImpl() {
84+
// surfar.renderBackground();
85+
// }
86+
87+
// protected void renderBackground() {
88+
// backgroundImpl();
89+
// surfar.renderBackground();
90+
// }
8591

8692

8793
@Override

mode/libraries/ar/src/processing/ar/PSurfaceAR.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import android.content.Intent;
3232
import android.content.pm.ConfigurationInfo;
3333
import android.content.res.AssetManager;
34+
import android.opengl.GLES11Ext;
3435
import android.opengl.GLES20;
3536
import android.opengl.GLSurfaceView;
3637
import android.view.*;
@@ -41,6 +42,7 @@
4142
import processing.android.AppComponent;
4243
import processing.core.PGraphics;
4344
import processing.core.PShape;
45+
import processing.opengl.PGL;
4446
import processing.opengl.PGLES;
4547
import processing.opengl.PGraphicsOpenGL;
4648
import processing.opengl.PSurfaceGLES;
@@ -51,6 +53,7 @@
5153
import java.io.File;
5254
import java.io.IOException;
5355
import java.io.InputStream;
56+
import java.nio.IntBuffer;
5457
import java.util.ArrayList;
5558
import java.util.Collection;
5659
import java.util.HashMap;
@@ -225,14 +228,9 @@ public AndroidARRenderer() {
225228
@Override
226229
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
227230
pgl.getGL(null);
228-
GLES20.glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
231+
// GLES20.glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
232+
229233
backgroundRenderer.createOnGlThread(activity);
230-
// try {
231-
// planeRenderer.createOnGlThread(activity);
232-
// } catch (IOException e) {
233-
// PGraphics.showWarning("Failed to read plane texture");
234-
// }
235-
// pointCloud.createOnGlThread(activity);
236234
}
237235

238236
@Override
@@ -263,15 +261,17 @@ public void onDrawFrame(GL10 gl) {
263261

264262
displayRotationHelper.updateSessionIfNeeded(session);
265263
try {
264+
266265
session.setCameraTextureName(backgroundRenderer.getTextureId());
266+
267267
frame = session.update();
268268
camera = frame.getCamera();
269269

270-
if (camera.getTrackingState() == TrackingState.PAUSED) {
270+
// if (camera.getTrackingState() == TrackingState.PAUSED) {
271271
// Just draw the camera image and do nothing else
272-
renderBackground();
273-
return;
274-
}
272+
// renderBackground();
273+
// return;
274+
// }
275275

276276
updateTrackables();
277277
updateMatrices();

0 commit comments

Comments
 (0)