[Original] texture transparent color (colorkey) in irrlicht)

Source: Internet
Author: User
Tags transparent color
Suppose we want to make a 24-bit color texture (without alpha) specific color transparent in render, you can call makecolorkeytexture to create a 1-bit Alpha Channel of the texture, set materialtype to emt_transparent_alpha_channel. Please refer Code : Scene: ianimatedmesh * meshrabbit = smgr-> getmesh (".../../Media/mouse22.ms3d ");
Scene: ianimatedmeshscenenode * anoderabbit = smgr-> addanimatedmeshscenenode (meshrabbit );
If (anoderabbit)
{
Driver-> settexturecreationflag (Video: etcf_always_16_bit, true );
IRR: Video: itexture * ptexture = driver-> gettexture (".../../Media/wenli.jpg ");
Driver-> makecolorkeytexture (ptexture, core: position2d <s32> ));

Anoderabbit-> setmaterialtexture (0, ptexture );
Anoderabbit-> setmaterialtype (Video: emt_transparent_alpha_channel );
Anoderabbit-> setposition (core: vector3df (70, 20,-60 ));
Anoderabbit-> setmaterialflag (Video: emf_lighting, false );
Anoderabbit-> setrotation (core: vector3df (0, 180.0f, 0 ));
Anoderabbit-> setanimationspeed (25*30 );
} Of course, if texture itself has an alpha channel, you don't need to make makecolorkeytexture any more. There are two other modes to try: emt_transparent_add_color and emt_transparent_alpha_channel_ref.

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.