Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
There's a set of these
eglCreate*Surface
APIs to create
surface
s in Android, I understand that API like
eglCreatePbufferSurface
create a backing buffer which can be rendered with GL calls, but I can't wrap my head around this one,
eglCreateWindowSurface(EGLDisplay display, EGLConfig cfg, Object window, ...)
, if I pass a
Surface
as the window, how could the system make what I draw using OpenGL on the window surface appear on the screen? I know it couldn't, because it doesn't even have a place in the layout in my Activity.
My confusion is if what I draw to the window surface doesn't appear
automatically
on the screen, why it ever exists? isn't it the same as the pixel buffer surface created with
eglCreatePbufferSurface
?
In the 3rd paragraph of this
doc
, which states:
From that point onward, rendering to that EGLSurface results in a buffer being dequeued, rendered into, and queued for use by the consumer. (The term "window" is indicative of the expected use, but bear in mind the output might not be destined to appear on the display.)
which confuses me more.
if I pass a
Surface
as the window, how could the system make what I draw using OpenGL on the window surface appear on the screen?
If you don't pass a valid operating system level native window handle as the
native_window
parameter of
eglCreateWindowSurface
it will throw an error. In short, if you pass junk into an API don't expect it to do anything sensible.
–
–
My confusion is if what I draw to the window surface doesn't appear automatically on the screen, why it ever exists? isn't it the same as the pixel buffer surface created with eglCreatePbufferSurface?
eglCreateWindowSurface
and
eglCreatePbufferSurface
both create rendering surfaces, I think the difference is
eglCreateWindowSurface
needs an on-screen native platform window as parameter, which is the main purpose of EGL, connect the native platform window system with OpenGL ES.
Thanks for contributing an answer to Stack Overflow!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.