Skip to content

WIP queueEvent #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

WIP queueEvent #4

wants to merge 4 commits into from

Conversation

hannesa2
Copy link
Collaborator

It's just a demonstration what I did.

I use queuEvent please see and log the current Thread out.

Indeed it's the wrong thread
image

@hannesa2
Copy link
Collaborator Author

hannesa2 commented Mar 17, 2021

I guess this is the causing line }, ContextCompat.getMainExecutor(this))

@hannesa2
Copy link
Collaborator Author

In an other project I do this

  LiveData<ProcessCameraProvider> getProcessCameraProvider() {
    if (cameraProviderLiveData == null) {
      cameraProviderLiveData = new MutableLiveData<>();

      ListenableFuture<ProcessCameraProvider> cameraProviderFuture =
          ProcessCameraProvider.getInstance(getApplication());
      cameraProviderFuture.addListener(
          () -> {
            try {
              cameraProviderLiveData.setValue(cameraProviderFuture.get());
            } catch (ExecutionException | InterruptedException e) {
              Log.e(TAG, "Unhandled exception", e);
            }
          },
          ContextCompat.getMainExecutor(getApplication()));
    }

I grabbed it from here

Sumarize: avoid val frame: Frame = session.update() in private fun bindCameraUseCases()

@abhishekk06
Copy link
Owner

Hi @hannesa2,

I am not sure I understood your changes fully. By any chance, you got time to test it on your end. Is it working for you?

@hannesa2
Copy link
Collaborator Author

No, I didn't finished it till now.
I (currently) only pointed out what's exactly wrong and showed you a working way to handle .addListener()

@hannesa2
Copy link
Collaborator Author

hannesa2 commented Mar 18, 2021

Now I run into

[type.googleapis.com/util.ErrorSpacePayload='ArStatusErrorSpace::AR_ERROR_TEXTURE_NOT_SET']

But the previous error MISSING_GL_CONTEXT is gone !

Can you solve it ?

@abhishekk06
Copy link
Owner

As per this, it happens when we call Session.update without having done session.setCameraTextureNames.

Any idea how to pass texture ID here?

@abhishekk06
Copy link
Owner

I don't understand how to pass "textureId" here. I tried hardcoding it to 0 but I am again getting a black screen and the following prints in the console.

E/native: session.cc:2264 Invalid ray produced by view data!
W/sessionDraw: GLThread 18038
E/native: session.cc:2264 Invalid ray produced by view data!
W/sessionDraw: GLThread 18038

@abhishekk06
Copy link
Owner

Hi @hannesa2,

By any chance did you able to figure what can go wrong?
Can you please suggest how to debug further?

@hannesa2
Copy link
Collaborator Author

First, try it by your own. I see no commit from you

@abhishekk06
Copy link
Owner

@hannesa2 sorry, I missed pushing commit with my second last comment. Please take a look.

Now I see "Invalid ray produced by view data!" after setting the texture name. Checking further to see if I did something wrong.

@@ -182,6 +182,8 @@ class CameraActivity : AppCompatActivity(), GLSurfaceView.Renderer {
Log.w("sessionUpdate", Thread.currentThread().name)

surfaceView.queueEvent {
//session.setCameraTextureName(0)
session!!.setCameraTextureNames(intArrayOf(0))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I need to use surfaceview here but I am not sure how to get texture ID for that. I don't see any similar helper function available.

@abhishekk06
Copy link
Owner

abhishekk06 commented Mar 23, 2021

As per the link given below, I set geometry when trying to place anchor but now I don't see any activity at all

google-ar/arcore-android-sdk#413

@@ -445,6 +445,8 @@ class CameraActivity : AppCompatActivity(), GLSurfaceView.Renderer {
val approximateDistanceMeters = 2.0f
// Performs a ray cast given a screen tap position.
val results = frame.hitTestInstantPlacement(0F, 0F, approximateDistanceMeters)
val displayRotation = display!!.rotation
session.setDisplayGeometry(displayRotation, 256, 256)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

google-ar/arcore-android-sdk#413

temporary hack for "Invalid ray produced by view data"

@hannesa2
Copy link
Collaborator Author

I formatted code again, to only see significant changes from you.
You use an own (non standard) codestyle

@abhishekk06
Copy link
Owner

abhishekk06 commented Mar 23, 2021 via email

@abhishekk06
Copy link
Owner

I am blocked here for a long time. Not sure how to proceed further :( @hannesa2 @owahltinez your suggestion is much needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants