OpenGL Super Treasure Note four-base texture 2

Source: Internet
Author: User

first, using the Mipmap map (mainly applied in the texture reduction filter)
Advantages:
prevents flickering problems when textures shrink too much
improves performance and does not load large memory textures when it needs to be scaled down
Disadvantages:
additional memory is required as a cost
composition: Consists of a series of reduced texture images, the child layer is the parent layer of the
Filter Type: Nearest fast, good linear effect
gl_nearest_minmap_nearestSelect nearest MIP layer and perform proximity filtering
Gl_nearest_minmap_linearSelect the most MIP layer linear interpolation and perform proximity filtering
gl_linear_minmap_nearest...
Gl_linear_minmap_linear...
generate MIP Layer: Can improve performance of running process
Glgeneratemipmap (gl_texture_2d)






Second, anisotropic filtration
The use of anisotropic texture filtering can greatly improve the quality of texture filtering operations because the viewing angle is considered when texture filtering, so there is no large ambiguity


Check if support: gltisextsupported ("Gl_ext_texture_filter_anisotropic")
get the largest number of anisotropic filtering applications: GLGETFLOATV (gl_max_texture_max_anisotropy_ext,&flargest)
applying anisotropic filtering: Gltextparameterf (gl_texture_2d,gl_texture_max_anisotropy_ext,flargest)
The greater the number of anisotropic filters applied, the more texture units are sampled along the maximum direction of change (along the strongest observer points). 1.0 means regular texture filtering (isotropic filtering)


The difference between using anisotropic filtering and using isotropic filtering:




third, texture compression
Pros: Textures remain compressed in the graphics hardware memory, loading speed becomes faster
use: Glteximage (), where the Internalformat is specified as GL_COMPRESSED_RGB with the compressed type
glcompressedteximage2d (), the Internalformat parameter type must be compressed


Iv. Examples of sphere reflections


Modelviewmatrix.pushmatrix (); m3dmatrix44f Mcamera;cameraframe.getcameramatrix (Mcamera); Modelviewmatrix.multmatrix (MCamera); Modelviewmatrix.pushmatrix ();//Flip Y-axis, Draw reflection Modelviewmatrix.scale (1.0f,-1.0f,1.0f); Modelviewmatrix.translate (0.0f, 0.8f,0.0f);//After all, the original front becomes clockwise, so change the vertex wrapping mode: Clockwise to positive glfrontface (GL_CW);D rawsonganddance (Yrot);// After painting the reflection to change back to the vertex wrapping mode Glfrontface (GL_CCW), Modelviewmatrix.popmatrix ();//Turn on the color mix, so that the reflection and the transparency of the base plate glenable (Gl_blend); Glbindtexture (Gl_texture_2d,uitexture[0]); Glblendfunc (gl_src_alpha,gl_one_minus_src_alpha); static GLfloat Vfloorcolor[] = {1.0f,1.0f,1.0f,0.75f};shadermanager.usestockshader (glt_shader_texture_modulate, Transformpipline.getmodelviewprojectionmatrix (), vfloorcolor,0); Floorbatch.draw (); gldisable (GL_BLEND);D Rawsonganddance (Yrot); Modelviewmatrix.popmatrix ();




-------------------------------------
void Glfrontface (glenum mode);
The effect is to control how the polygon's front is determined. By default, mode is GL_CCW.
The value of mode is:
GL_CCW indicates that the vertex order of the projected polygon on the window coordinates is the front of the counterclockwise direction of the surface.
GL_CW indicates that the vertex order is a clockwise surface with a positive face.
the direction of the vertex is also called wrapping.

OpenGL Super Treasure Note four-base texture 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.