How to render texture in ogre

Source: Internet
Author: User

In my opinion, rendering to a texture is not much different from rendering to a window. If you must make a difference, the rendering target is different. The latter is a window, and the former is a texture.

The trilogy about rendering to textures is excerpted from a user's blog below:

1. Specify the tu_rendertarget parameter to create the rendering target texture. During the creation of the rendering target texture, ogre automatically calls root: getsingleton (). getrendersystem ()-> attachrendertarget adds this texture to the root rendering target, that is, each frame is rendered to this texture.
Textureptr texture = texturemanager: getsingleton (). createmanual ("rtttex ",
Resourcegroupmanager: default_resource_group_name, tex_type_2d,
512,512, 0, pf_r8g8b8, tu_rendertarget );

2. Get the rendering target. Only when the rendering target is available can the target be specified with the view and camera.
Rendertarget * rtttex = texture-> getbuffer ()-> getrendertarget ();

3. Specify the camera for the rendering target. After this step, the camera will be rendered to texture when each frame is updated.
Viewport * V = rtttex-> addviewport (mreflectcam );

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.