coordinates.Since the device uses a left-handed coordinate system, the default is the right-hand coordinate system when OpenGL is drawn, so the near/far definition needs to be reversed in the setting of the orthogonal matrix.Final float aspectratio = width > height? (float) width/(float) Height: (float) height/(float) width; if (Width > height) { Orthom (ProjectionMatrix,0,-apositionloca
Start with an HTC Touch HD. Otherwise, it would be a pity that the big screen.
The query shows that although the HD configuration is still acceptable, it is a pity that the CPU of Qualcomm's msm7201a is too shabby to support OpenGL ES. On glbenchmark, we can see that it only supports es1.0, and elasticsearch benchmark is normal.
However, even so, there is always better than none.
Start writing esProgra
from viewpoint 7 );3. Projection mode-Perspective projectionThe projection lines of the perspective projection are not parallel, and they intersect at the viewpoint. Through the perspective can be produced in the real world "near big far small" effect.1 Matrix.frustumm (2 Mprojmatrix, // storage Generation matrix element float[] Type array 3 0, // Fill Start offset 4 Left,right, //
Create a DrawLine Activity that defines four vertices:float vertexarray[] =-0.8f,-0.4f1.732f0.0f- 0.4f0.4f1.732f0.0f0.0f,-0.4f1.732f 0.0f0.4f0.4f1.732f0.0f,};Draw the line in three modes Gl_lines,gl_line_strip,gl_line_loop, respectively: Public voidDrawscene (GL10 gl) {super. Drawscene (GL); Bytebuffer VBB= Bytebuffer.allocatedirect (vertexarray.length*4); Vbb.order (Byteorder.nativeorder ()); Floatbuffer Vertex=Vbb.asfloatbuffer (); Vertex.put (Vertexarray); Vertex.position (
A vertex set:
private float vertices[] = { -1.0f, 1.0f, 0.0f, // 0, Top Left -1.0f, -1.0f, 0.0f, // 1, Bottom Left 1.0f, -1.0f, 0.0f, // 2, Bottom Right 1.0f, 1.0f, 0.0f, // 3, Top Right 2.0f, 1.0f, 0.0f, // 4, Top 2Right 2.0f, -1.0f, 0.0f, // 5, Bottom 2Right};
Set to draw only the front (counterclockwise)
GL. glfrontface (gl10.gl _ CCW); //
We can use frame buffer objects to achieve off-screen rendering. Frame buffer objects support the following operations1. Create a Frame buffer object using only the OpenGL ES function.2. Create multiple FBO using EGL context.3. Create the off-screen color, depth, template render buffer, and texture, and bind them to the frame buffer object.4. Share color, depth,
connection phase
Function prototype: The String glgetprograminfolog (int program) parameter means: The programs is the ID of a shader application.
5. Cleaning shaderWhen you no longer need a shader or a program, you need to clean it up to free up resources.
Function Prototypes:
void Gldeleteshader (int shader)
Parameter meaning:
Shader is the ID of the vertex shader or slice shader to be excluded
6. Creating a Program Objectint program = Gles20.glcreatep
Shader is an important part of OpenGL ES.Brief introductionThe shader program is a program that runs on the GPU and is a program written in GLSL language.FunctionWith OpenGL shaders, you can enrich rendering, and the features you can implement include:(1) More authentic materials-metal, stone, wood, etc.(2) More realistic lighting effects-area lighting, soft shad
Surfaceview's black background blocks the parent's background, and now sets the surfaceview background to be transparent, seeing both the 3D object being painted and the background.In onsurfacecreated, call Gles20.glclearcolor (0f, 0f, 0f, 0f); Alpha is 0, which is transparent.Then, the Surfaceview must be treated as follows:Mglsurfaceview.seteglconfigchooser (8, 8, 8, 8, 16, 0);Testrenderer renderer = new
This paper mainly discusses the algorithm to extend the line into 2d line surface.It's easy to extend the P0P1 line into a polygon.vec2f line = P1-p0vec2f normal = vec2f (-line.y, line.x). Normalized () .vec2f A = p0-thickness * normal;vec2f B = p0 + thickness * normal;vec2f c = p1-thickness * normal;vec2f d = p1 + thickness * normal;If this is a straight line, but if there is a polyline, we also need to calculate the intersection point whereFirst we'll find out tvec2fT= ((P2-P1). Normalized ()
The use of fog in the scene not only improves realism, but also optimizes performance in specific situations. In particular, when the object is far enough away from the camera, the fog is strong enough to see only the fog and not see the object, it is not necessary to the object coloring detailed calculation, which can greatly improve rendering efficiency.There are many mathematical models of fogLinear Model:F=max (min (end-dist)/(End-start), 1.0), 0.0)
F is the atomization factor, the val
conversion)
The sequence of coordinate transformation directly affects the final result when the mesh (mesh, which constitutes the basic unit of three-dimensional form) is translated and selected at the same time.
For example, the system first translates and then rotates, and the center of the rotation is the coordinate after the translation.
Select and then pan:To translate, it is relative to the coordinate system after rotation:
A basic principle is that the coordinate transformation is perfo
Chapter 2 of OpenGl learning and Chapter 2 of opengl
After openGl is basically drawn, it's time to move from a plane to a three-dimensional one. Now, to draw a Golden Triangle, the main problem is the fixed-point array, GL10.GL _ TRIANGLES,
GL_TRIANGLES-this parameter means
code sets the background color to Black:
Glclearcolor (0, 0, 0, 1 );
1.4 clear screen and buffer before painting
Generally, we write the call of all the plotting functions in the renderscene process. We should clear the screen and buffer before each draw. The following code uses the specified clear color to clear them:
Void renderscene
{
Glclear (gl_color_buffer
NotoginsengGlutinitdisplaymode (Glut_single | GLUT_RGB);//single-buffered, RGB-mode -Glutinitwindowsize ( -, -); theGlutinitwindowposition ( $, $); +Glutcreatewindow ("Triangles");//Window Title A init (); the /*Drawing and displaying*/ +Glutreshapefunc (Myreshape);//behavior to take when the window size has changed -Glutdisplayfunc (Mydisplay);//Show Drawing drawing $Glutmainloop ();//Loops $ return(0); -}Click the local Windows debugger to
OpenGL usage in MFC (2) -- derived OpenGL class, mfcopengl
Sometimes OpenGL needs to be configured every time, which is a little troublesome. You can directly derive an OpenGL Class Based on CWND and use it directly when necessary. The following is an example of this class,
://developer.android.com/reference/javax/microedition/khronos/opengles/GL11Ext.html)
GL11ExtensionPack (http://developer.android.com/reference/javax/microedition/khronos/opengles/GL11ExtensionPack.html)
2. OpenGL ES 2.0 API class
Android. opengl. ELES20 ------ this package provides the
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.