Comments (4)
You can use a single EGL context for multiple surfaces, or have separate EGL contexts for each surface and configure them to share state. The former is probably easier. You can see an example in the "continuous capture" activity, which receives camera frames in a SurfaceTexture and then renders each frame twice (once to a display surface, once to a video encoder surface).
If you really want to keep your GLES state separate, you can create separate EGL contexts for each SurfaceView, and just pass the EGLContext from the first to the EglCore constructor for the others. The "show + capture camera" activity uses this approach, though it's a bit convoluted because it's not easy to get the EGLContext out of a GLSurfaceView.
It will be much more efficient to use a single SurfaceView. Each additional SurfaceView means an additional layer composited by the system; once you hit the hardware composer's limit you're placing an additional burden on the GPU. It will also be faster to switch shader programs than entire EGL contexts, so using a single EGLContext is best. See "hardware scaler exerciser" for an example of using multiple programs to draw one frame -- it uses different shaders for flat-shaded and textured rendering.
(In the future, please post questions on stackoverflow.com. There's a larger set of people who can answer questions, and other people will be able to find and benefit from the answers.)
from grafika.
Hi,
Thanks for your quick answer! I have to admit that I do not understand
everything in your post but now I have all the material and I can dive into
it.
Regarding the "hardware scaler exercise", the thing is the shader is
changed for the whole scene. In my case, I want to change the shader only
for one of the two items. Is that possible?
Thanks again,
Best,
Thibaut
Ps: I tried posting to stackoverflow.com but it seems to me that the post
is already deep in the list. (
http://stackoverflow.com/questions/27194321/multi-view-of-a-video) Have you
seen it? Did I do something wrong with it?
Le 3 déc. 2014 18:13, "Andy McFadden" [email protected] a écrit :
You can use a single EGL context for multiple surfaces, or have separate
EGL contexts for each surface and configure them to share state. The former
is probably easier. You can see an example in the "continuous capture"
activity, which receives camera frames in a SurfaceTexture and then renders
each frame twice (once to a display surface, once to a video encoder
surface).If you really want to keep your GLES state separate, you can create
separate EGL contexts for each SurfaceView, and just pass the EGLContext
from the first to the EglCore constructor for the others. The "show +
capture camera" activity uses this approach, though it's a bit convoluted
because it's not easy to get the EGLContext out of a GLSurfaceView.It will be much more efficient to use a single SurfaceView. Each
additional SurfaceView means an additional layer composited by the system;
once you hit the hardware composer's limit you're placing an additional
burden on the GPU. It will also be faster to switch shader programs than
entire EGL contexts, so using a single EGLContext is best. See "hardware
scaler exerciser" for an example of using multiple programs to draw one
frame -- it uses different shaders for flat-shaded and textured rendering.(In the future, please post questions on stackoverflow.com. There's a
larger set of people who can answer questions, and other people will be
able to find and benefit from the answers.)—
Reply to this email directly or view it on GitHub
#15 (comment).
from grafika.
If you look at draw() (currently https://github.com/google/grafika/blob/master/src/com/android/grafika/HardwareScalerActivity.java#L666) you can see it rendering the rect/triangle with either flat or textured shading, and then drawing the edge rects with flat. The draw() methods are actually re-selecting the program for every mesh, which isn't ideal, but Grafika isn't attempting to be a high-performance game engine.
For stackoverflow, it's important to get the right set of keywords. Keeping up with "android" is nearly impossible, but "surfaceview" rarely gets more than one question per day. I have a set of favorite keywords that I poke through. android-camera is one of them, but apparently I missed your question.
from grafika.
Hi,
Thanks for your answer again! That's very nice. I got it for the shader
thing. I will give it a try soon and let you know.
Best regards,
Thibaut
Le 4 déc. 2014 17:27, "Andy McFadden" [email protected] a écrit :
If you look at draw() (currently
https://github.com/google/grafika/blob/master/src/com/android/grafika/HardwareScalerActivity.java#L666)
you can see it rendering the rect/triangle with either flat or textured
shading, and then drawing the edge rects with flat. The draw() methods are
actually re-selecting the program for every mesh, which isn't ideal, but
Grafika isn't attempting to be a high-performance game engine.For stackoverflow, it's important to get the right set of keywords.
Keeping up with "android" is nearly impossible, but "surfaceview" rarely
gets more than one question per day. I have a set of favorite keywords that
I poke through. android-camera is one of them, but apparently I missed your
question.—
Reply to this email directly or view it on GitHub
#15 (comment).
from grafika.
Related Issues (20)
- Sound not available in Video using CameraCaptureActivity HOT 1
- how can i remove shape HOT 1
- how can i add shapes in texture view using open gl
- glReadPixels returns a blank image on disabling blend
- Decoding four video streams simultaneous on Google Pixel 2 phone
- seconds of video in Continuous Capture mode becomes double after keeping it on for a while. HOT 3
- If you want to record mp4 with sound, use this one https://github.com/moo611/OpenCamera
- Memory leak of Texture2dProgram
- Continuous capture bug(Android5.1.1) HOT 1
- Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x38 in tid 9379, pid 9379
- Some OpenGL stuff doesn't work on some devices: eglMakeCurrent failed and glDrawArrays: glError 0x505 HOT 4
- How to show front and back camera simultaneously? HOT 5
- Can we play scene.json in grafika?
- Test HOT 1
- Doesn't build on Flamingo and Giraffe HOT 2
- fun fact HOT 1
- Camera2 Pass Images from ImageReader to MediaRecorder HOT 2
- Camera2 pipeline; synchronously get PRIVATE/YUV/RGB Image data from a Frame HOT 4
- Website
- OpenGL + MediaRecorder.VideoEncoder.AV1 - a freezing video (like very low fps)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grafika.