OpenGL selection and feedback mechanism)

Source: Internet
Author: User
Http://bbs.ogdev.net/TopicContent.aspx? Boardid = 2 & topicid = 7659

Developers who have used OpenGL selection and feedback mechanisms may find it unsatisfactory. It is shown in the following aspects:
I. WritingProgramComplex.

To use the selection feedback mechanism, you need to switch the rendering mode, operate the naming stack, calculate the picking matrix, and check the selected records. These tedious steps are prone to errors and are very difficult for debugging, it only reduces work efficiency and enthusiasm.

2. You can only select elements.

For users, the picking mechanism provided by OpenGL is indeed limited.

3. Reduced rendering efficiency.

Selection and feedback in OpenGL are different from normal rendering methods. During usage, the normal scenario is first rendered in the frame cache and then re-painted in the selected mode. At this time, the content of the frame cache remains unchanged. That is to say, in order to select some objects, we need to use different rendering methods in one frame to render them twice. We know that rendering objects is time-consuming. When there are many and complex objects to be selected in the scene, using this mechanism will greatly affect the speed.

 

In the OpenGL redbooks, we introduced a simple method: Re-paint all objects with different colors in the backbuffer, and each object uses a single color to indicate its color, in this way, we can read the color of the point where the mouse is located to determine the selected object. This method is flawed. When the number of objects to be selected in the scene exceeds a certain limit, the number of identifiers may overflow. For this problem, the solution provided by hongbao is to scan multiple times. Practice has proved that this method is indeed simple and easy, but it still has many limitations, and it is not much easier to do than the first mechanism. I will not repeat it for further details.

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.