|
Note: For Original Articles, please refer to EOE Forum http://www.eoeandroid.com/thread-66564-1-1.html! ZTE X-876 shot pictures, good effect, please support domestic!
I. Texture knowledge
A simple understanding of texture is to paste the image to the corresponding polygon. If you need to map multiple textures to the same polygon, it is best to use the MASK technology.
Ii. Texture steps
1. Enable texture: glable (gl10.gl _ texture_2d );
2. Create a texture: glgentextures ();
3. Bind the texture: glbindtexture (gl10.gl _ texture_2d, textureid );
4. Generate the texture: glutils. teximage2d (); // The second parameter of this method is used for multi-level texture.
5. Texture restrictions
6. texture coordinates: such as square texture and triangle texture
7. Image configuration: linear interpolation, repetition, and stretch Restriction
3. texture coordinates
When we specify the vertex in the vertex array, we need to provide texture coordinates in another array, which is called the texture coordinate array. For each vertex, we will pass two (S, T) to specify the position of the coordinate system shown in the image.
|
Iv. Image Configuration
1. Linear interpolation
Gl. gltexparameterf (gl10.gl _ texture_2d, gl10.gl _ texture_min_filter, gl10.gl _ lines );
Gl. gltexparameterf (gl10.gl _ texture_2d, gl10.gl _ texture_min_filter, gl10.gl _ lines );
2. Duplicate
Gl. gltexparameterf (gl10.gl _ texture_2d, gl10.gl _ texture_warp_s, gl10.gl _ repeat); // The axis is repeated.
Gl. gltexparameterf (gl10.gl _ texture_2d, gl10.gl _ texture_warp_t, gl10.gl _ repeat); // The T axis is repeated.
3. Restrict stretch Effect
Gl. gltexparameterf (gl10.gl _ texture_2d, gl10.gl _ texture_warp_s, gl10.gl _ clamp_to_edge); // s axis limit
Gl. gltexparameterf (gl10.gl _ texture_2d, gl10.gl _ texture_warp_t, gl10.gl _ clamp_to_edge); // T axis limit
5. Set the texture coordinate Array
Gltexcoordpointer (2, gl10.gl _ float, 0, texture []);
Vi. Normal Vector
1. The normal line is a "dotted line" that is always perpendicular to a plane ".
2. vertex normal is a vector of a vertex that is used to calculate illumination and texture effects in a Gouraud shading. When a surface is generated, the normal of the vertex and the normal of the adjacent plane are usually kept at an equal angle of 2. In this way, a smooth transition effect is generated at the plane joint during rendering. If it is a polygon, make the vertex normal equal to the normal of the plane (triangle) to which the vertex belongs, 3, to generate a prominent edge at the joint.
-----> Figure 2
-----> Figure 3
3. For the three-dimensional surface, the normal direction is: Generally, the normal pointing from the three-dimensional interior to the external is the normal direction "positive direction", and the opposite is the normal direction "negative direction ".
4. The normal of each plane of the cube.
----> Figure 4
7. How to texture cubes in multiple aspects
Based on the knowledge of the previous parts, we draw the six sides of the cube separately, and perform a texture ing (bind the corresponding texture ID) When no surface is drawn ), this produces multi-faceted texture ing to the effect.
8,
9. Source Code
Please download from the EOE forum. Http://www.eoeandroid.com/thread-66564-1-1.html