Basic concepts of Quartz and OpenGL plotting, zopengl plotting

Source: Internet
Author: User

Basic concepts of Quartz and OpenGL plotting, zopengl plotting

Sometimes the application needs to be able to customize the drawing. We can rely on two different libraries to meet our drawing needs. One library is Quartz 2D, which is part of the Core Graphics framework, and the other is OpenGL ES, which is a cross-platform Graphics library. OpenGL ES is a simplified version of cross-platform graphics library OpenGL. OpenGL ES is a subset of OpenGL. OpenGL ES is specially designed for embedded systems such as iPhone.

Quartz is a set of functions, data types, and objects. It is designed to draw views or images directly in memory. Quartz regards the view or image being drawn as a virtual canvas and follows the so-called painter model. This is just a strange way. The reason is that the method of applying the drawing command is largely the same as that of applying the paint to the canvas. If you paint the entire canvas in red and then the lower half of the canvas in blue, the canvas will be half red, half blue, or purple. If the pigment is opaque, it should be blue. If the pigment is translucent, it should be purple.

The Quartz virtual canvas works in the same way. If the entire view is red and the lower half of the view is blue, you will have a half red, half blue, or purple view, this depends on whether the second drawing operation is completely opaque or partially transparent. Each drawing operation is applied to the canvas and above all previous drawing operations.

On the other hand, OpenGL ES is implemented in the form of a state machine. This concept may be a bit difficult to understand, because it cannot be attributed to a simple metaphor, such as painting on a virtual canvas. OpenGL ES does not allow operations that directly affect views, windows, or images. It maintains a virtual 3D world. When an object is added to this world, OpenGL tracks the state of all objects. While OpenGL ES does not provide a virtual canvas, it provides a virtual window into its world. You can add objects to the world and define the location of the virtual window relative to the world. OpenGL then draws a view based on the configuration method and the positions of various objects, and presents it to the user through this window.

Quartz is relatively easy to use. It provides various straight lines, shapes, and image rendering functions. Although easy to use, Quartz 2D only supports 2D painting. Although many Quartz elements use hardware acceleration for plotting, it is not guaranteed that any operations performed in Quartz are accelerated.

Although OpenGL is complex and hard to understand, its power is unquestionable. It also provides 2D and 3D Painting tools. It is specially designed to make full use of hardware acceleration. It is also ideal for programming games and other complex, graphic-intensive programs.

Related Article

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.