Method 1: images are directly displayed without ry (see "OSG 3D rendering engine design and practice" p119 of Wang Rui and Qian xueshi to draw bitmaps in the scene ):
Osfg: ref_ptr <OSG: drawpixels> BMP = new OSG: drawpixels;
BMP-> setposition (OSG: vec3 (0.0, 0.0, 0.0 ));
BMP-> setimage (osgdb: readimagefile ("***. PNG "));
OSG: ref_ptr <OSG: geode> geode = new OSG: geode;
Geode-> adddrawable (BMP. Get ());
Method 2: configure the stateset of the node with a ry (refer to OSG Navy tutorial 2nd: Apply stateset to create a stateset
Texture ry ):
OSG: texture2d * kln89facetexture = new OSG: texture2d;
Kln89facetexture-> setdatavariance (OSG: object: Dynamic );
OSG: Image * klnface = osgdb: readimagefile ("kln89faceb. TGA ");
Kln89facetexture-> setimage (klnface );
OSG: stateset * stateone = new OSG: stateset ();
Stateone-> settextureattributeandmodes (0, kln89facetexture,
OSG: stateattribute: On );
Geode-> setstateset (stateone );
Another method is to call drawimplement () for plotting, now let's take a look ???????????????????????????