Ogre: manualobject

Source: Internet
Author: User

In ogre, we usually import Point Mesh files to construct objects. However, in many cases, we may need to create a very simple plane or line, or sometimes you want to create such an object in a program, you need to use the manual object of ogre, just as you use OpenGL to draw an object in a program, define the information you draw in the program, but it is similar to drawing an object in OpenGL.

The method for creating a person to create an object is usually as follows:

1. Use the scenario manager to create a pointer for a person to create an object.

Manualobject * mo = smgr-> createmanualobject ("Mo ");

2. Then use the begin/end of the man-made object to draw, which is similar to that in OpenGL, but the rules are somewhat different:

Mo-> begin ("basewhitenolighting", renderoperation: ot_triangle_list); first, specify the elements and materials to be drawn.

Then the following figure shows the vertex information,

Use Mo-> position to specify the position of a vertex, and then specify the color and direction of the vertex before the sentence and the next Mo-> position, this is totally different from OpenGL.

For example

Mo-> position (-100,100, 0)

Mo-> color (0, 0, 1 );
Mo-> position (100,100, 0 );

The color of the first vertex is blue, not the second vertex!

If no color information is specified, the color of the store is the color of the last vertex with the specified color.

You can write multiple begin end pairs in another manulobject.

After manualobject is created, to render it in the scene, you only need to use scenenode: attach to a scene node.

Or sometimes you need to convert this manualobject to a mesh and call the converttomesh function of manualobject.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/leonwei/archive/2010/08/09/5799748.aspx

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.