public void selectTechnique(String name, final RenderManager renderManager) {
        // check if already created
        Technique tech = techniques.get(name);
        // When choosing technique, we choose one that
        // supports all the caps.
        if (tech == null) {
            EnumSet<Caps> rendererCaps = renderManager.getRenderer().getCaps();
            List<TechniqueDef> techDefs = def.getTechniqueDefs(name);
            if (techDefs == null || techDefs.isEmpty()) {
                throw new IllegalArgumentException(
                        String.format("The requested technique %s is not available on material %s", name, def.getName()));
            }

            TechniqueDef lastTech = null;
            float weight = 0;
            for (TechniqueDef techDef : techDefs) {
                if (rendererCaps.containsAll(techDef.getRequiredCaps())) {
                    float techWeight = techDef.getWeight() + (techDef.getLightMode() == renderManager.getPreferredLightMode() ? 10f : 0);
                    if (techWeight > weight) {
                        tech = new Technique(this, techDef);
                        techniques.put(name, tech);
                        weight = techWeight;
                    }
                }
                lastTech = techDef;
            }
            if (tech == null) {
                throw new UnsupportedOperationException(
                        String.format("No technique '%s' on material "
                                + "'%s' is supported by the video hardware. "
                                + "The capabilities %s are required.",
                                name, def.getName(), lastTech.getRequiredCaps()));
            }
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, this.getMaterialDef().getName() + " selected technique def " + tech.getDef());
            }
        } else if (technique == tech) {
            // attempting to switch to an already
            // active technique.
            return;
        }

        technique = tech;
        tech.notifyTechniqueSwitched();

        // shader was changed
        sortingId = -1;
    }
Select the technique to use for rendering this material.
<p>
Any candidate technique for selection (either default or named)
must be verified to be compatible with the system, for that, the
<code>renderManager</code> is queried for capabilities.

@param name The name of the technique to select, pass
{@link TechniqueDef#DEFAULT_TECHNIQUE_NAME} to select one of the default
techniques.
@param renderManager The {@link RenderManager render manager}
to query for capabilities.

@throws IllegalArgumentException If no technique exists with the given
name.
@throws UnsupportedOperationException If no candidate technique supports
the system capabilities.
jme3-core/src/main/java/com/jme3/material/Material.java