Пример #1
0
SamplerState::SamplerState()
{
    memset(this, 0, sizeof(SamplerState));

    setMinFilter(GL_NEAREST_MIPMAP_LINEAR);
    setMagFilter(GL_LINEAR);
    setWrapS(GL_REPEAT);
    setWrapT(GL_REPEAT);
    setWrapR(GL_REPEAT);
    setMaxAnisotropy(1.0f);
    setMinLod(-1000.0f);
    setMaxLod(1000.0f);
    setCompareMode(GL_NONE);
    setCompareFunc(GL_LEQUAL);
    setSRGBDecode(GL_DECODE_EXT);
}
Пример #2
0
PHRect PHGLTexture2D::loadFromData(uint8_t * buf, size_t w, size_t h, size_t bw, size_t bh, enum pixelFormat fmt, bool aa)
{
    if (gm->hasCapability(PHGLCapabilityAppleLimitedNPOT))
    {
        bool pots = ((w & ~(w ^ (w-1))) == 0) && ((h & ~(h ^ (h-1))) == 0);
        if (!pots)
        {
            aa = false;
        }
    }
    
    bind_begin;
    setWrapS(clampToEdge);
    setWrapT(clampToEdge);
    setMinFilter(aa?linearMipmapNearest:linear);
    setMagFilter(linear);
    setData(buf, bw, bh, fmt);
    bind_end;
    
    return PHRect(0, 0, w/float(bw), h/float(bh));
}
Пример #3
0
void Sampler::setWrap(GLint wraps_, GLint wrapt_, GLint wrapr_)
{
    setWrapS(wraps_);
    setWrapT(wrapt_);
    setWrapR(wrapr_);
}