Skip to content
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

Produced SurfaceTexture is only 1 color #96

Open
Bosa17 opened this issue Apr 12, 2021 · 14 comments
Open

Produced SurfaceTexture is only 1 color #96

Bosa17 opened this issue Apr 12, 2021 · 14 comments

Comments

@Bosa17
Copy link

Bosa17 commented Apr 12, 2021

I am trying to use sceneform's startMirroringtoSurface method on the GLSurfaceTextureProducerView inherited views following MediaPlayer exmple. But I am getting single color results when using canvas.drawSurfaceTexture

Please help me to understand how this is happening or how I can rectify it

@Bosa17
Copy link
Author

Bosa17 commented Apr 12, 2021

I think it has to do with wrong UV mapping of the texture

@Bosa17
Copy link
Author

Bosa17 commented Apr 12, 2021

I think it is only sampling the color of the left bottom pixel of the image and displaying it as whole

@ChillingVan
Copy link
Owner

Hello, which texture do you draw? The producedSurfaceTexture or something defined by yourself? And what's your producedSurfaceTexture?

@ChillingVan
Copy link
Owner

And what about the sample code of the MediaPlayer?Does it work on your device?

@Bosa17
Copy link
Author

Bosa17 commented Apr 13, 2021

Yes, the media player sample works fine. I follow the same code structure that is shown in the sample. I use the producedSurfaceTexture as tge second arg in the drawSurfaceTexture function

@ChillingVan
Copy link
Owner

Could you share your code as a project or snippet with enough information?
In the media player example, the surface texture is provided to the media surface. So do you create your surface?
And does sceneForm do something to the surface? Maybe not only the opengl canvas manipulate the surface.

@Bosa17
Copy link
Author

Bosa17 commented Apr 13, 2021

https://github.com/Bosa17/TimBerr

The concerned activities are ArtWorkDisplayActivity and PreviewSurfaceTextureView

@Bosa17
Copy link
Author

Bosa17 commented Apr 13, 2021

Sceneform just renders output to the surface.

@ChillingVan
Copy link
Owner

Do you know which color format outputed from the sceneform? Usually for media or camera the surface is YUV format so the ProducedTextureTarget should be GLES11Ext.GL_TEXTURE_EXTERNAL_OES. But for format like Bitmap ARGB8888, the ProducedTextureTarget should be GLES20.GL_TEXTURE_2D.
You can set the ProducedTextureTarget when the GLSurfaceTextureProducerView creates.

@Bosa17
Copy link
Author

Bosa17 commented Apr 17, 2021

I tried using both. The GLES20.GL_TEXTURE_2D produces no result and onGlDraw is only called once. The other format produces the same single color results

@Bosa17
Copy link
Author

Bosa17 commented Apr 17, 2021

Is there any scenario where RawTexture just gives 1 cokor resukt?

@ChillingVan
Copy link
Owner

I tried using both. The GLES20.GL_TEXTURE_2D produces no result and onGlDraw is only called once. The other format produces the same single color results

onGlDraw only called once. That's to say, onFrameAvailable is only called once. Maybe you can check whether the sceneForm has triggered rendering the surface

@ChillingVan
Copy link
Owner

Is there any scenario where RawTexture just gives 1 cokor resukt?

It may not has relation with the RawTexture..

@ChillingVan
Copy link
Owner

I check the startMirroringToSurface again.
And I think there should be one other thing in the whole part. That is the media or the Camera.
For current code, there is nothing for the input surface. So neither the sceneForm nor the PreviewSurfaceTextureView has input for the surface so they cannot render anything from the surface

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

No branches or pull requests

2 participants