Pro Android with Kotlin


CHAPTER 9: User Interface


Download 5.42 Mb.
Pdf ko'rish
bet177/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   173   174   175   176   177   178   179   180   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile



211
CHAPTER 9: User Interface
Fast Graphics OpenGL ES
For Android apps you can use the industry-standard OpenGL ES to render high-
performance graphics in 2D and 3D. The user interface development differs significantly 
from the standard Android OS way, and you have to expect to spend some time learning 
how to use OpenGL ES. In the end, however, you might end up with outstanding graphics 
that pay off for the effort.
OpenGL ES comes in different versions: 1.x, 2.0, and 3.x. While there is a huge difference in 
methodology between 1.x and the later versions, the difference between 2.0 and 3.x is not 
so big. But setting 3.x as a strict requirement, you miss about one-third of all possible users 
(by beginning 2018), so the recommendation is this:

Develop for OpenGL ES 2.0 and only if you really need it add 3.x 
features. If using 3.x, you best supply fallbacks for devices that do not 
speak 3.x.
In the following sections, we will be talking about version 2.0.
OpenGL ES is extremely versatile, and usage patterns are potentially endless. Covering all 
that OpenGL ES provides goes beyond the scope of the book, but I will present the following 
scenarios to get you started:

Configure the Activity to use OpenGL ES

Provide a custom GLSurfaceView class to hold the OpenGL scene

Provide two graphics primitives: a triangle that uses a vertex buffer and 
a shader program, and a quad that uses a vertex buffer, an index buffer, 
and a shader program

Provide a renderer to paint the graphics

Briefly outline how to introduce view projection

Briefly outline how to add motion

Briefly outline how to add light

Briefly outline how to react to user input
Note OpenGL ES for Android is supported by both the framework and also the Native 
Development Kit (NDK). In the book we will be putting more weight on the framework classes.
Note It doesn’t make sense to use OpenGL ES if the Android OS user interface provides the same 
functionality and performance is not an issue.



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   173   174   175   176   177   178   179   180   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling