1. How do I draw a triangle with OpenGL es?
- Write a class implement renderer interface, implement Ondrawframe method, Onsurfacechanged method, onsurfacecreated method
- Write a class triangle class, define fixed-point coordinates, load all vertex coordinates, call a gldrawarrays method of GL10 to draw a triangle
- Finally, call triangle.drawself in the overridden Ondrawframe method to actually draw the triangle
2.OpenGL es What are the methods for drawing a rectangle?
- Triangular rotation (but requires a corner of 90 degrees)
- Vertex method to draw a rectangle, first define 4 vertex coordinates
- Index method to draw a rectangle
3. What are the limitations of drawing polygons using the index method?
- You must use byte[] to define a fixed-point index with no more than 255 indexes
4. How do I draw a four-sided pyramid?
- Note: Any image drawn using OpenGL ES is spelled out with a triangle.
- Define 4 faces, 3 points per polygon
- Then ondrawframe the method to draw 4 triangles to form a four-pyramid
5. How do I color the 6 faces of a cube?
- A color consists of 4 values (RGBA), 4 vertices per plane, and a plane requires 16 values to describe the color
- The cube has 6 faces and requires a total of 96 values to describe the color
- Define a 96-length array to record the color, and then use the Gldrawarrays method to draw the cube
What kinds of light sources does 6.OpenGL es support?
- Directional light
- Positioning light
7. What is the meaning of the ambient light, scattered light and specular reflection of OpenGL ES light source?
- The pname parameter value of ambient light is gl10.gl_ambient, which represents the rgba intensity of ambient light added by a particular light source in the scene. 、
- Scattered light, the parameter is Gl10.gl_diffuse, comes from a certain direction, after hitting the surface of the object, it will scatter evenly.
- Specular reflection Light, parameter: Gl10.gl_specular, from a specific direction
Android Interview Collection video OpenGL ES