void STDRenderer::setTexture(spNativeTexture base, spNativeTexture alpha, bool basePremultiplied)
    {
        if (base == 0 || base->getHandle() == 0)
            base = white;

        unsigned int shaderFlags = _shaderFlags;

        if (basePremultiplied)
            shaderFlags &= ~UberShaderProgram::ALPHA_PREMULTIPLY;
        else
            shaderFlags |= UberShaderProgram::ALPHA_PREMULTIPLY;

        if (alpha)
            shaderFlags |= UberShaderProgram::SEPARATE_ALPHA;
        else
            shaderFlags &= ~UberShaderProgram::SEPARATE_ALPHA;

        //##ifdef OX_DEBUG
#if 0
        if (_base != base) { OX_ASSERT(_alpha != alpha); }
        else { OX_ASSERT(_alpha == alpha); }
#endif //OX_DEBUG

        //no reason to check changed alpha because it is in pair with base
        if (_base != base || /*_alpha != alpha || */_shaderFlags != shaderFlags)
        {
            drawBatch();
        }

        _shaderFlags = shaderFlags;

        _base = base;
        _alpha = alpha;
    }
 void VideoDriverGLES20::setTexture(int sampler, spNativeTexture t)
 {
     oxglActiveTexture(GL_TEXTURE0 + sampler);
     if (t)
         glBindTexture(GL_TEXTURE_2D, (GLuint)((size_t)t->getHandle()));
     else
         glBindTexture(GL_TEXTURE_2D, 0);
     CHECKGL();
 }
    bool RenderTargetsManager::isGood(const spNativeTexture& t, int w, int h, TextureFormat tf) const
    {
        if (!t)
            return false;

        if (!t->getHandle())
            return false;

        if (t->getFormat() == tf &&
                t->getWidth() >= w && t->getHeight() >= h &&
                t->getWidth() <= (w + ALIGN_SIZE) && t->getHeight() <= (h + ALIGN_SIZE))
            return true;
        return false;
    }
 bool MTLoadingResourcesContext::isNeedProceed(spNativeTexture t)
 {
     return t->getHandle() == 0;
 }
 bool SingleThreadResourcesContext::isNeedProceed(spNativeTexture t)
 {
     return t->getHandle() == 0;
 }
 bool isNeedProceed(spNativeTexture t)
 {
     return t->getHandle() == 0;
 }
        TextureLine(spNativeTexture t)
        {
            setVerticalMode(Box9Sprite::TILING_FULL);
            setHorizontalMode(Box9Sprite::TILING_FULL);
            Sprite::setResAnim(DebugActor::resSystem->getResAnim("checker"));

            AnimationFrame f;
            Vector2 s = fitSize(itemSize, Vector2((float)t->getWidth(), (float)t->getHeight()));

            setSize(s);

            Diffuse df;
            df.base = t;

            f.init(0, df, RectF(0, 0, 1.0f, 1.0f), RectF(0, 0, s.x, s.y), s);
            spSprite image = initActor(new Sprite,
                                       arg_blend = blend_disabled,
                                       arg_resAnim = f);
            addChild(image);

            spColorRectSprite rect = initActor(new ColorRectSprite,
                                               arg_color = Color(Color::White, 255),
                                               arg_attachTo = this);

            rect->addTween(Sprite::TweenColor(Color(Color::White, 0)), 4000, -1, true);

            char path[255];
            path::normalize(t->getName().c_str(), path);

            char txt[255];
            safe_sprintf(txt, "%s\n<div c=\"FF0000\">%s</div>-<div c=\"0000ff\">%dx%d</div>\nid: %d tid: %d",
                         path,
                         textureFormat2String(t->getFormat()),
                         t->getWidth(), t->getHeight(), t->getObjectID(), (int)(size_t)t->getHandle());

            spTextField text = initActor(new TextField,
                                         arg_color = Color::Black,
                                         arg_w = (float)itemSize.x,
                                         arg_vAlign = TextStyle::VALIGN_TOP,
                                         arg_hAlign = TextStyle::HALIGN_LEFT,
                                         arg_multiline = true,
                                         arg_attachTo = rect,
                                         arg_htmlText = txt
                                        );

            text->setBreakLongWords(true);

            rect->setSize(text->getTextRect().size.cast<Vector2>() + Vector2(2, 2));
            rect->setY((itemSize.y - rect->getHeight()) / 2.0f);
        }