(ext.) simple-framework (MALISDK frame analysis)

Source: Internet
Author: User

originating from: http://blog.csdn.net/u013467442/article/details/46940501

simple-framework (Mali SDK Framework Analysis)

1. All definitions and implementations are placed in the same namespace, and the file contains # include typically outside of the namespace. The total namespace is namespace malisdk{}, and when used USINGNAMESPACEMALISDK contains the contents of all namespaces.

2. The type is defined in the header file and is implemented in the corresponding. cpp file with #ifndef, #define, #endif来防止多次包含的问题. The definition is separated from the implementation phase.

Each file function:

1. VectorTypes.h: A vector type is defined in the file and implemented with a custom struct type. There are mainly vec2,vec3,vec4 to represent the 2,3,4 dimension vector of integer type, which is used to store coordinates and other data. Similarly, vec2f, vec3f, vec4f represent a vector of floating-point types. There is no corresponding. cpp file, only the type defined in the. h file.

2. Platform.h: Defines the abstract base class Platform. It then generates three sub-class Windowsplatform;desktoplinuxplatform;linuxonarmplatform for a specific platform through public inheritance.

2.1 static variable parameter member functions defined in abstract base class log (const char* format, ...) To print the log information, which is indirectly combined into Gl_check (x) to detect the return value of the GL function.

Voidplatform::log (const Char*format, ...)

{va_list ap;

Va_start (AP, format); AP points to the first address of the variable parameter

vfprintf (stderr, format, AP);//main function

fprintf (stderr, "\ n");

Va_end (AP);

}

#defineGL_CHECK (x) \

X \//return value first, then error checking and handling in block statement

{ \

Glenum glerror = Glgeterror (); \

if (glerror!= gl_no_error) {\

LOGD ("glgeterror () =%i (0x%.8x) at%s:%i\n", Glerror, Glerror, __file__, __line__); \

Exit (1); \

} \

}

2.2 LOGD macro to print debugging information. Print debug information If debug is defined, otherwise it will not print

Examples of usage:

LOGD ("vertexshaderid=%d", Vertexshaderid);

The text is defined as follows:

#ifdef DEBUG

#define LOGD fprintf (stderr, "Debug:"); Platform::log

#else

#define LOGD

There are three types of macro definitions for printing information:

#define Logiplatform::log Logi used to print normal information

#define LOGEFPRINTF (stderr, "Error:"); Platform::log Loge used to print the wrong information

LOGD Macros to print debugging information.

2.3 Static platform* getinstance (void); invokes the getinstance function of the corresponding platform according to different platforms, returns a pointer to the base class of the derived class object, and calls the subclass virtual by the virtual function and polymorphism of the base class. Voidcreatewindow (int width, int height), virtual void DestroyWindow (void), virtual windowstatus checkwindow (void); Specific implementation methods.

3. Linuxonarmplatform class: The class of the arm-based Linux platform. Three virtual functions are implemented specifically for the platform environment.

Creates a window through the Fbdev_window structure.

4. Desktoplinuxplatform class: Linux platform-based classes. Three virtual functions are implemented specifically for the platform environment.

5. Windowsplatform class: Windows platform-based classes. Three virtual functions are implemented specifically for the platform environment.

6. Eglruntime class: Primarily manages and configures EGL-related interface calls. Static variables are used in all classes. Configure the display environment.

Configattributes []: Specifies the Config property list, which is the configuration of the required properties that we specify, mainly Rgba,buffer, depth cache size, rendering type, and size of the anti-aliasing sample points.

Contextattributes[]: A list of context properties, primarily the version of the specified OpenGL es.

windowattributes[]: Window Properties list. Specifies whether the render surface is a foreground buffer or a background buffer.

INITIALIZEEGL function: Configure a display window environment through a series of EGL interface calls.

Eglgetdisplay: Creates and initializes a connection to the local EGL display and opens the connection to the EGL display server.

Eglinitialize: After successfully opening the connection, the EGL needs to be initialized.

Eglchooseconfig: Queries all EGL surface configurations supported by the underlying windowing system, and EGL returns the best configuration list through Configattributes [] specified requirements. First returns the number of optimal configurations, and allocates a space store to return the array of sub-configuration lists. Then select RGB, the depth of the most matching configuration.

Eglcreatewindowsurface: Creates a render area on the screen based on the most matching configuration.

Eglcreatecontext: Creates a render context.

Eglmakecurrent: Make Eglcontext the current context.

Eglswapbuffers: Exchange foreground and background buffers.

Terminateegl function: Cleanup work at the end.

7. Shader class: Used to create and compile a shader object.

Loadshader: Loads the shader source code into a character array or character pointer by file form.

Processshader: Creates shader objects, provides shader source code, compiles shaders, and looks at the compiler state of the shader. If compilation fails, the shader source and shader compiled log information is printed.

8. Matrix class: And matrices related classes, define common evidence and common evidence operations, such as translation, rotation, scaling, multiplication, positive projection transformation of the proof, perspective projection transformation matrix, transpose, inverse matrix and so on. ( matrix column main order )

Identityarray: a static unit matrix in a class.

Degreestoradians: Angle to radians.

Multiply or *: Matrix multiplication, column main order.

Getasarray: Returns a pointer to a matrix element.

Matrixscale: Multiplies each element of the matrix by one scaling factor at a time.

Createscaling: Creates a scaling matrix.

Createtranslation: Creates a translation matrix.

Matrixperspective: Create a Perspective matrix.

Matrixorthographic: Create a ortho matrix.

Createrotationx,createrotationy,createrotationz: Rotates around the x-axis, y-axis, and z-axis.

Vertextransform: Multiplies the vertex vector matrix.

Print: Prints the matrix element.

Matrixtranspose: Matrix transpose.

Matrixdeterminant: Expands the value of the determinant of a 3x3 or 4x4 matrix by the first line.

Matrixinvert: The inverse matrix of matrices is obtained by the accompanying evidence.

9. Timer class: Provides a high-precision timer class, the use of hardware timers, counters to achieve platform independent timing, divided into the Linux version and Windows edition, the main analysis of Windows version.

Reset: Resets the current timestamp to the current time of the counter conversion.

GetTime: The time difference between the current time and the timestamp at reset.

Getinterval: The difference between the current time and the last time interval node.

Getfps: Calculates frames per Second every second.

Istimepassed: Produces a certain time interval. The default is 1 seconds.

Read:

Prototype: boolqueryperformancefrequency (Large_integer *lpfrequency);

Function: Returns the frequency of the high-precision counters supported by the hardware.

Return value: Non-zero, hardware support high precision counters; 0, hardware not supported, read failed.

The QueryPerformanceFrequency () function should be called before timing to obtain the clock frequency of the internal timer of the machine. Then QueryPerformanceCounter () is called before and after the event that requires strict timing, and the exact time of the event can be calculated using the difference in counts and the clock frequency obtained two times.

Etcheader class: Get information about etc file headers from etc compressed textures. The file header in the. pkm file format has a total of 16 bytes, of which the first 6 bytes are used to describe the file format name, version type. 7, 8 bytes are null bytes. 8,9 the highest least significant bit of compression texture width, 10,11 is the highest and least significant bit of the compressed texture height. 12,13 the highest least significant bit of the original texture width, 14,15 the highest and least significant bit of the original texture height.

GetWidth: The width of the original texture. GetHeight: The length of the original texture.

Getpaddedwidth: The width of the compressed texture. Getpaddedheight: The length of the compressed texture.

GetSize: The size of the compressed texture, in bytes. (ETC1 4 bits per pixel, 4 or 8 bits in ETC2)

Texture class: using textures.

Getcompressedtextureformats: Gets the supported compressed texture formats and quantities.

Isetcsupported: Determines whether etc texture compression is supported, and prints key information such as texture information and quantity support.

LoadData: Reads data from a file and can read compressed or uncompressed texture data.

CreateTexture: Creates a texture image of a specified size with random data. (Rgba four Channel

CreateTexture: can also be used to generate single-channel textures. (r single channel)

Deletetexturedata: Deletes the texture image generated by the createtexture.

Loadpkmdata: Extract the ETC compressed texture files from the. PKM compressed texture file header 16 Bytes, extract the texture data, and return a pointer to the texture data.

Loadcompressedmipmaps: Automatically loads various levels of mipmap compressed textures. From level0 to the maximum level, the compression texture levels bound to different mipmap are loaded sequentially by glcompressedteximage2d.

Text class: Use texture to draw ANSI to display characters. The size of each character is 8*16 pixels. The scale of the font size is set to 1.0 by default, and other reasonable values range from 0.75-3.0.

Geometry class: Used to generate geometric shapes, mainly produce rings, ball vertex data, cubes, rectangle vertex data and normal vectors.

Top
1
Step

(ext.) simple-framework (MALISDK frame analysis)

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.